In case of using simple RewriteRule directive our URL changes with the query string as well but if we want to use the existing GET parameters along with the new parameters appended we should use the flag [QSA].Using flag [QSA] appends the new query string parameters to the existing one.
For example let us say we have a RewriteRule as below:
RewriteRule /images/(.+) /image.php?page=$1
Now we can see the two cases
Case 1: If we use RewriteRule without [QSA]:
RewriteRule /images/(.+) /image.php?page=$1
/images/523?one=two =>/image.php?page=523
(Here the existing query string has been discarded).
Case 2: If we use [QSA] with RewriteRule:
RewriteRule /images/(.+) /image.php?page=$1 [QSA]
/images/523?one=two =>/image.php?page=523&one=two
For more information see the link below:
Link: http://httpd.apache.org/docs/2.2/en/rewrite/flags.html#flag_qsa
0 Comment(s)