RewriteRule in htaccess in subdirectory

Posted by Jay on Server Fault See other posts from Server Fault or by Jay
Published on 2010-05-01T01:21:09Z Indexed on 2010/05/02 15:08 UTC
Read the original article Hit count: 258

Windows server, running Apache. In my Apache conf, I have AllowOverride None for the root of a site and then I have a subdirectory set to AllowOverride All:

<Directory />
AllowOverride None
</Directory>
<Directory "/safe/">
AllowOverride All
</Directory>

However, when I try to set up a rewrite rule in the subdirectory's htaccess file, nothing happens, I just get a 404 page not found error. Example:

RewriteEngine On
RewriteRule (.*) /blah?test=$1 [R=302,NC,NE,L]

Rwewriting URLs are working fine from the root via the Apache conf. I don't understand why the rule is ignored. I don't want to do the URL re-writing within the conf because for this case I may need to be changing the redirects constantly and don't want to reload the server every time a change is made. I also don't want to affect server performance by enabling htaccess files site-wide, just in the subdirectory I need it.

© Server Fault or respective owner

Related posts about apache

Related posts about .htaccess