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
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 ?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.