What is the difference between [L]
and [end]
?last
and end
are the same, aren't they?
In my .htaccess
I have
RewriteEngine On
RewriteBase /
# I use this only to test my $_SERVER variables
RewriteRule ^phpinfo phpinfo.php [QSA,L]
RewriteRule ^(.*)$ index.php?data=$1 [QSA,L]
and the behaviour of the both end
and L
is the same. I suppose that in a more complicated example it won't be, so can you give me such an example?
From the docs:
The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed.
and
Using the [END] flag terminates not only the current round of rewrite processing (like [L]) but also prevents any subsequent rewrite processing from occurring in per-directory (htaccess) context.
What does this mean?
L (last - stop processing rules) Last rule: instructs the server to stop rewriting after the preceding directive is processed. N (next - continue processing rules) NC (case insensitive) NE (do not escape special URL characters in output) NS (ignore this rule if the request is a subrequest)
RewriteRule "\.exe" "-" [F] This example uses the "-" syntax for the rewrite target, which means that the requested URI is not modified. There's no reason to rewrite to another URI, if you're going to forbid the request.
htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.
Yes. In the RewriteCond , it's basically saying that it'll run the rewrite as long as $1 doesn't equal on of the files listed to the right of the condition.
It relates to the global apache configuration. If you use [L]
in httpd.conf then there still is a chance to apply some rules in .htaccess. But if you use [END]
the game is over and .htaccess can not add anything
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With