QSA flag not in IIRF?

Topics: User Forum
Jul 7, 2008 at 5:56 PM
Hello...

We came across a bug in our product in apache that required adding a QSA flag to one of our rules. When I went to check on our rules in IIRF I don't see that flag as being supported. Is that the case? I came across some cursory info on the web indicating that IIS handles query strings a little differently but I'm not entirely sure as to the semantics. Is QSA necessary?


Here's what we had happening in Apache:

http://webpage/?action=print

Is rewritten to:

http://webpage/index.php?title=

but it should be:

http://webpage/index.php?title=&action=print


To fix that, we had to add the QSA flag, as here:
RewriteRule ^/$ /index.php?title= [L,QSA,NE]

Is that flag not necessary if we have the following in our ini file? (It's kind of complex so I apologize):

RewriteCond %{QUERY_STRING} ^$ [OR]
RewriteCond %{URL} ^/Special:
RewriteRule ^/([^\?]*)(?:\?(.*))?$ /index.php?title=$1&$2 [L]

Thanks!
Coordinator
Jul 7, 2008 at 9:36 PM
Edited Oct 28, 2009 at 9:14 PM

Update: As of mid-2009, QSA is now supported on the latest IIRF.

Hi!

Whether QSA is necessary or interesting depends on what you want to do.
I did not know of the QSA flag, but I read about it here: http://rewrite.drbacchus.com/rewritewiki/Flags_2fQSA

QSA stands for "Query String Append."  It is a convenience to handle the case where there may or may not be a query string in place.  The QSA says, append the original query string, if any, to the result of the rewrite replacement pattern. 

It is always possible to manage this without the QSA flag, either with intelligently designed rewriterules and the clever use of regular expressions, or with a set of two or more rules covering the cases (eg, one rule covering the case where the original URL request DOES NOT have a query string, and one rule covering the case where it DOES.)   

so the answer to "is the QSA flag necessary?" is .. .it depends on what your requirements are!