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

I don't know what's going on but I cannot make use of the rewrite module. In my .htaccess file I have a rule like this: RewriteRule ^test$ test.php. If test.php does not exists I get a 404 error saying that it cannot find the test.php file, which is correct (also, the rule matched). After I add the test.php file when I access the test url I also get a 404 not found, but this time is telling me that it cannot find /test (which makes me think that rule doesn't matches).

What's the issue ? I don't follow. I've tried anything but I cannot make it to work properly.

share|improve this question
What are you attempting to accomplish with your rewrite rule? Basically, you are saying that the URL has to ONLY contain the word "test" and that will be rewritten to "test.php". – Eirik Toft Mar 27 '13 at 18:20
yes, I know what the rule does, I used test to imply that this is an example, but the problem exists with any rule. – misterjinx Mar 27 '13 at 18:23
If that is the only rule that is supposed to match in that case, try adding a "[R,L]" to the end of the rule. Also, you might increase the log level for this. Keep in mind that levels of 3 and below are utterly useless, but the higher will show you what and why things happen. – Eirik Toft Mar 27 '13 at 18:26
thanks, but it doesn't work. I don't know why it's doing this. it's the first time when something like this happens to me – misterjinx Mar 27 '13 at 21:15

/test is not ^test$, it should be ^/test$

Edit: Have you tried this: RewriteRule ^/test$ /test.php [R,L] ?

share|improve this answer
no, sorry, doesn't solve the problem – misterjinx Mar 27 '13 at 21:14
do you have the [R,L] after the rule, as Eirik suggested? Furthermore, do you have RewriteEngine On? – Marcel Mar 27 '13 at 21:22
yes, I have it. – misterjinx Mar 27 '13 at 21:25
Are you sure the browser is not putting a trailing slash at the request? – Marcel Mar 27 '13 at 21:26
yes, the browser is not altering the url. I really can't figure out this strange behaviour. this is a new environment, maybe could be something related to permissions ? is it possible ? – misterjinx Mar 27 '13 at 21:33
up vote 0 down vote accepted

I figured out what was causing this behaviour. In the vhost configuration file I had to put -MultiViews to the Options rule. Now it's working as it should.

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.