What is [QSA] and similar for in Rewriterule?

Asked

Viewed 2,526 times

8

I have as an example the following RewriteRule ^(Home)?/?$ page/php/Home.php [NC,L]
I know that the NC is Non-Case(Não diferencia maiúsculas e minusculas).
L means that if a RewriteRule is true he stops checking.

But I saw several examples using QSA as well and I couldn’t find an explanation that would clarify what QSA means and what its use is.
So pegunto, What does this QSA mean? What is its use? Are there other "operators" (I don’t know what they are called) besides these? if yes, what are its uses?

2 answers

5

These "operators" are called 'flags' of mod_rewrite apache

Here’s a list of them (http://httpd.apache.org/docs/2.4/rewrite/flags.html)

[QSA] stands for Query String Append.

Keeps the same query string and adds var=val at the end of the URI

RewriteRule ^/pagina /pagina?var=val [QSA]

TO URI: /site5/ver.php?pagina=1 will be rewritten to /site/ver.php?site=5&pagina=1

RewriteRule /site5(.*) /site/$1?site=5 [QSA]
  • Very good link, had not found it before, I suggest you add some of the most important flags to your reply to make it more complete

-2

Although the mdma have responded very well. I would add that it is widely used in frameworks mainly in PHP to prevent the loss of the Query String and still manage to continue working with friendly urls. It is worth giving a read on the link informed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.