使用modrewrite重定向带有查询字符串的URL

时间:2010-04-14 19:31:06

标签: mod-rewrite query-string

我正在尝试将使用查询字符串的旧网址重定向到没有的新网址。

/tripinfo.cfm?RiverNameID=1&AdventureID=6

现在需要转到

/trips/big-ass-river/overnight.html

所以我正在努力..

RewriteRule  ^tripinfo.cfm?RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]

但这不起作用。

我可以使用

重定向主页没问题
 RewriteRule  ^tripinfo.cfm$  /trips.html [R=301]

如果有人能告诉我我失踪了什么会很棒。

1 个答案:

答案 0 :(得分:1)

我认为是?标记需要转义。 试试这些?

RewriteRule  ^tripinfo.cfm\?RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]

RewriteRule  RiverNameID=1&AdventureID=6$  /trips/big-ass-river/overnight.html   [R=301]
相关问题