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

Following Exception doesn't work. http://www.domain.com with and without /test redirect to http://www.example.de/foo/, but the exception should not!

RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/test$
RewriteRule ^(.*)$ http://www.example.de/foo/ [R=302,L]

What's the reason?

share|improve this question

migrated from stackoverflow.com Oct 1 '12 at 2:33

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

1 Answer 1

up vote 2 down vote accepted

It conflicts with the rule

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

at the end of the .htaccess file.

If I add an exception for index.php like

RewriteCond %{HTTP_HOST} ^www.domain.example$ [NC]
RewriteCond %{REQUEST_URI} !^/test$
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.*)$ http://www.example.org/foo/ [R=302,L]

then it works.

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.