mod-rewrite,从URL1参数传递给URL2 [英] Mod Rewrite, pass parameters from URL1 to URL2

查看:114
本文介绍了mod-rewrite,从URL1参数传递给URL2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图重写以下网址

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]

难道这样做使用的RewriteCond还是其他什么东西?提前(比方说,可以这样做吗?),谢谢。

Could this be done using RewriteCond or something else? (say, could this be done ?), thanks in advance.

推荐答案

您可能想要的东西,如 QSA (查询字符串附加)标志,这将导致剩余查询字符串的被正确地附加到重写的URL的结尾。

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.

例如:

^test.php test.php?hidden=value [L,QSA]

这篇关于mod-rewrite,从URL1参数传递给URL2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆