Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

In my Apache httpd.conf file I have this declaration inside a VirtualHost tag.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

And this inside my .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

The rule in my httpd.conf seems to be ignored. Are the rules in .htaccess wiping out the httpd.conf rewrite rule?

share|improve this question

migrated from Aug 24 '10 at 14:06

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

Generally your settings in .htaccess file inside a directory overrides httpd.conf file settings. You can disable this effect by editing your httpd.conf file and change the following line

  <Directory ...> 
  AllowOverride all


    <Directory ...> 
    AllowOverride none

This will prevent .htaccess file from overriding httpd.conf settings. So the settings in .htaccess file will have no effect.

share|improve this answer
I have AllowOverride All, but I think in this case it's because the .htaccess catches the request and redirects it before it hits the rules in the http.conf file. See… – Shane Stillwell Sep 4 '10 at 2:36

if you have a <Directory ...> with AllowOverride all then whatever you have on your .htaccess file will be replacing any previous rule.

It could be in your httpd.conf or on your virtualhost as long as it point to / or to your domain path.

share|improve this answer

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.