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 thought the [L] flag indicated that "this rule should be the last rule processed for this http request.."

However when I have 2 rules like:

RewriteRule ^test$ php/test.php [L]
RewriteRule (.*) error.php

What always happens is requests to http://localhost/test go to error.php, not to test.php as I expected, since I put the [L] there. If you comment out the second rule there, then requests to http://localhost/test go to test.php as expected.

What I'm really trying to do is catch 404 errors with mod_rewrite. Its possible what I'm trying to do is just plain wrong. But I still want to know why the catch-all rule is active since I did put an [L] after the ^test rule.

I see a large listing in here where the server admin lists a bunch of paths that begin with the recognized directories, but I wanted to avoid doing this by simply using a nice catch-all rule.

share|improve this question
If you comment out both rules, where does http://localhost/test end up? – Steven Monday Dec 23 '10 at 23:55

If a rule results in a client redirect then it will re-enter the rule list again from the top when the client makes the redirected request.

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.