Forum Moderators: coopster & phranque

Message Too Old, No Replies

Mod Rewrite Flags

Can anyone help and explain some flags for me

         

annefromuk

8:25 pm on Jan 30, 2002 (gmt 0)

10+ Year Member



I am glad I found this board, I am already on my second post :) with probly a lot more to come.

After reading the Apache mod_rewrite guide, I have a few questions on the flags.

L (last rule) - I have seen this used on every line in a mod_rewrite example, which made me confused as it says on the documentation that this flag stops the rewriting process, does this mean that it only stops processing all the following rules if the current rule is met?

QSA (query string append) - The help doc says that QSA forces the rewriting engine to append a query string part in the substitution string to the existing one instead of replacing it.
Can someone help and explain what this means as I have seen this used as a rule for a PHP script.

Thanks

sugarkane

5:05 pm on Jan 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard anne

>only stops processing all the following rules if the current rule is met

Yep, exactly right. In many (most?) cases you will only want one rule to match, or things could become seriously confusing as the URL becomes rewritten multiple times. The L flag basically says 'Enough!!' once the rule has been met. This also saves on processing overhead, as only as many rules are tried as are needed to provide a match.

>QSA

Okay, as I understand it: Say you had a rewrite rule that resulted in a url such as www.somesite.com/index.cgi?foo=1 , and then a later rule needed to add further parameters to the end, without using QSA you'd end up with something like www.somesite.com/index.cgi?foo=1?bar=2 (note the two ?s)

The QSA flag would force the rule to take account of this and use an & instead of the second ? - ie www.somesite.com/index.cgi?foo=1&bar=2

I wouldn't take my QSA explanation as gospel though, it's just what I can gather from reading the docs - if anyone can clarify/correct me then please do :)