问题
I'm trying to rewrite the following URL
test.php?par1=foo&par2=bar
Into...
newtest.php?hidden_par=blah&par1=foo&par2=bar
I have this rule, that does not work:
RewriteRule ^test.php\??(.*?)$ newtest.php?hiden_par=blah&$1 [L]
Could this be done using RewriteCond or something else? (say, could this be done ?), thanks in advance.
回答1:
You probably want something like the QSA
("query string append") flag, which causes the remainder of the query string to be properly appended onto the end of the rewritten URL.
For example:
^test.php test.php?hidden=value [L,QSA]
来源:https://stackoverflow.com/questions/639869/mod-rewrite-pass-parameters-from-url1-to-url2