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

Is it possible to include a .htaccess in another .htaccess file. The purpose would be to have a single location of all .htaccess.

Thanks Jean

share|improve this question

It seems it's not possible.

But you could use any htaccess rules in httpd conf VirtualHost or Directory conext, where includes are possible.


<Directory /var/www/site1/>
   Include /etc/apache/conf.d/

See also:

share|improve this answer
But would not that require an apache restart – Jean Mar 24 '11 at 19:40
No, it would require reload (graceful restart - no connections aborted). If you need grant reload rights to non-privileged users, you could use sudo. – rvs Mar 25 '11 at 9:17
Which is exactly I dont want to do. If I do require, I have to restart apache via a php page. – Jean Mar 25 '11 at 16:04

If I understand correctly, Apache will check for an .htaccess file in every directory above the current one where AllowOverride is set to something other than None.

This means if your DocumentRoot for a site is /var/www/hello/, and it's serving a request for /path/name/filename, it will check for:

So if you like, you can use a single .htaccess file in your server's DocumentRoot, or even above that to affect multiple sites, as long as AllowOverride allows it for that directory.

share|improve this answer
And it will combine all that match? – nafg Jun 20 at 20:42
@nafg Yes, any directives found in a later .htaccess file should take precedence over what's in the earlier ones, provided the server's AllowOverride for that directory permits it. – Drew Bloechl Jun 24 at 6:13

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.