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

I have .htaccess files at multiple levels of a directory heirarchy, each with RewriteRules in them. However, when arequest is made for a file in a subdirectory, only the rules in the most deeply nested .htaccess file (up to the level of the requested file) are ever processed. Even having only a single line with "RewriteEngine On" is a subdirectory is enough to "disable" all rewrites defined in higher directories. This happens both for apache and litespeed httpd.

I had expected (and can't find any information otherwise) that all the RewriteRules would be combined into a single ruleset (presumably with deeper levels being processed last). However this doesn't seem to be happening.

Quite confused :) What am I not understanding?

Thanks, Mike.

share|improve this question
up vote 0 down vote accepted

Have you set RewriteOptions Inherit in each .htaccess?

In per-directory context this means that conditions and rules of the parent directory's .htaccess configuration are inherited. Rules inherited from the parent scope are applied after rules specified in the child scope.

share|improve this answer
Yes, thanks for your help, I had mistakenly thought that that only inherited "options," such as RewriteBase etc... as I had tried it but it wasn't working, I think due to some [L] flags (also though parent rules were applied first!). At any rate inheriting options in this way seems a bit limited, as it (for me at least) strips the current directories prefix (i.e. not that of the parent directory), and also keeps adding the path-info from the initial request URI (not the current state of the substitution). Is this the only mechanism for combining RewriteRules across multiple directories? – user62830 Dec 8 '10 at 6:39

Your Answer


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