Jump to content

mod_rewrite per directory basis


Buyocat

Recommended Posts

Hi, I can't for the life of me figure out where the problem lies, it is most likely in my httpd.conf file.  What I want is for directory A to have mod rewrite active while directory B (most likely a sub-directory of A) has mod rewrite off.  I have tried accomplishing this with .htaccess files or with directives in the .conf file, but with no luck; all I can do is turn it on or off for everything.  I do this by simply including the rewrite rules and commands at the end of my httpd.conf file...  When I try encasing the rewrite commands in a directive they do not seem to work.  Below is the important stuff in the conf:
[CODE]
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order Deny,Allow
    Deny from all
</Directory>

<Directory "/A">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    IndexIgnore *.svn *.cvs *.jpg *.gif *.ico *.htaccess .*
</Directory>

<FilesMatch "^\.ht">   
    Order allow,deny   
    Deny from all   
    Satisfy All
</FilesMatch>

RewriteEngine on
# Some rules follow
# When I put RewriteEngine ... into a directive, such as <Directory A>
# nothing happens
[/CODE]
The .htaccess files have either a copy of the RewriteEngine portion, cut from the httpd.conf or a "RewriteEngine off" command; either way they don't seem to do anything; I'm fairly certain they're being read as when I write a .htaccess file with the following in it...
[CODE]
foobar
[/CODE]
I am confronted with the server error page.

Thanks for your help!
Link to comment
https://forums.phpfreaks.com/topic/21192-mod_rewrite-per-directory-basis/
Share on other sites

Hello

I want to know that how can it possible to make a dynamic subdomain using .htaccess file and mod_rewrite ?

My idea is,

I want  to redirect http://subdomain.mydomain.com to http://mydomain.com/redirect.php?id=subdomain


How can this possible in apache's mod rewrite ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.