Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "/safe/">
AllowOverride All

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.

share|improve this question

migrated from May 2 '10 at 15:00

This question came from our site for professional and enthusiast programmers.

Turn on the RewriteLog ( This should at least give you a hint what mod_rewrite is trying to do. – joschi May 2 '10 at 15:24

Beware of Directory & Location tags in Apache configuration, they have really differents meaning. Directory works on filesystem & location on URIs.

If you're talking about an URL like this: you should do like this:

<Location /safe>
    AllowOverride All
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.