Mask
Mask

Reputation: 34207

What does [L] mean in apache rewrite?

Like here:

RewriteEngine on 
RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L] 

Upvotes: 6

Views: 8004

Answers (5)

NeilCrosby
NeilCrosby

Reputation: 872

[L] is a flag that means that if this rule matches, then no other rule matching will be performed for this page.

The mod_rewrite documentation says:

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.

However, the documentation goes on to note that [L] should not be relied on on its own to stop mod_rewrite processing as if, for example, your rule causes an HTTP redirect then it's possible to re-encounter the ruleset again, which can result in infinte loops.

It is therefore important, if you are using RewriteRule directives in one of these context that you take explicit steps to avoid rules looping, and not count solely on the [L] flag to terminate execution of a series of rules

Upvotes: 15

Rudd Zwolinski
Rudd Zwolinski

Reputation: 27581

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.

From the Apache mod_rewrite Flags documentation.

Upvotes: 1

lemonad
lemonad

Reputation: 4198

It means that if this rule matches, no more rule matching should be done. L = Last.

Documentation for l/last.

Upvotes: 1

RageZ
RageZ

Reputation: 27313

it means last, the rewrite engine will stop searching for matching rules. You can consult the documentation.

Usually it's use to avoid to match other rule, you can use it when you are sure you don't need to do any other rewriting.

Upvotes: 0

Matt
Matt

Reputation: 44058

If the rule matches, no more will be processed.

Check out the full list of flags: http://httpd.apache.org/docs/2.2/rewrite/rewrite_flags.html

Upvotes: 1

Related Questions