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

1 Answer 1

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

 
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.