Mod Rewrite, pass parameters from URL1 to URL2

六眼飞鱼酱① 提交于 2020-01-02 08:23:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!