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.

I have a .htaccess fil on a Apache22 server.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?p=$1 [L]

The idea is when the request is /testpage it should be rewritten to /index.php?p=testpage. The problem is that apache does a write before my file, so the actually request is testpage.xml which actually does exists. Therefore, the first RewriteCond is newer true, and my rewrite rule is never applied on the /testpage request.

So, apache is rewriting /testpage => /testpage.xml before my .htaccess-files is activated. A modrewritelog does also say that the requested file is /testpage.xml.

There server should be a standard setup on a FreeBSD server. I know this work on other servers.

share|improve this question
    
Wait, so are you requesting /testpage or testpage.xml? –  solefald May 17 '10 at 15:56
    
Have tried to specified it. I request /testpage to the server. –  Lauer May 17 '10 at 16:10
    
You should update your post to also include the rules that do the first rewrite. –  solefald May 17 '10 at 16:33
    
I don't know where the first rewrite happend. Then I would just have disabled it. I have solved it by adding <code>RewriteRule ^(.+)\.xml$ /index.php?p=$1 [L]</code> Not just the best solution. –  Lauer May 17 '10 at 18:30

1 Answer 1

I'm guessing that you have Options MultiViews on, and mod_negotiation is handling the request before mod_rewrite gets to it.

share|improve this answer

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.