Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.shanestillwell.com$ [NC]
RewriteRule ^(.*)$ http://www.shanestillwell.com/$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 stackoverflow.com Aug 24 '10 at 14:06

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

add comment

2 Answers 2

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
add comment

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

to

    <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 stackoverflow.com/questions/3557040/… –  Shane Stillwell Sep 4 '10 at 2:36
add comment

Your Answer

 
discard

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.