QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.
L means if the rule matches, don't process any more RewriteRules below this one.
Hi, what are some easy examples to explain the use of L? I can't seem to grasp this explanation above. Any help will be highly appreciated. Thanks.
The
QSAflag means to append an existing query string after the URI has been rewritten. Example:URL=
http://example.com/foo/bar?q=blahRule:
Result=
/index.php?b=barNotice how the
q=blahis gone. Because the existing query string is dropped in favor of the one in the rule's target, (b=$1). Now if you include aQSAflag:The result becomes=
/index.php?b=bar&q=blahThe
Lflag simply means to stop applying any rules that follow. Given the same URL,http://example.com/foo/bar?q=blah, and given the rules:The first rule gets applied and the URI gets passed through unchanged (via the
-target). The rewrite engine then processes the next rule, and the URI gets rewritten to/bar.php?z=foo/bar. What happens when you add anLto the end:The URL
http://example.com/foo/bargets passed through untouched from the first rule, then stops because of theLflag. If the URL ishttp://example.com/something/elsethen the first rule doesn't match and the second rule gets applied, rewriting the URI to:/bar.php?z=something/elseNote that since the rewrite engine loops through all the rules until the URI stops changing, the
Lflag will not prevent the looping, only any further rules from getting applied in the current iteration.