Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess [L] and [end] flags

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?

like image 571
Al.G. Avatar asked May 13 '14 11:05

Al.G.


People also ask

What does l mean in htaccess?

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)

What is RewriteRule * F?

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.

What is RewriteCond in htaccess?

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

What is $1 rewrite rule?

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.


1 Answers

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

like image 98
JimiDini Avatar answered Sep 29 '22 19:09

JimiDini