简单的htaccess重定向没有查询字符串

时间:2013-06-10 13:23:31

标签: .htaccess redirect query-string

我想重定向以下链接 http://www.example.com/full-tang-polished-samurai-katana-sword.htmlhttp://www.example.com/final-fantasy-advent-children-cloud-buster-sword.html

我使用了几种方法,包括

Redirect 301 /full-tang-polished-samurai-katana-sword.html http://www.example.com/final-fantasy-advent-children-cloud-buster-sword.html

哪个产生

http://www.example.com/final-fantasy-advent-children-cloud-buster-sword.html?full-tang-polished-samurai-katana-sword.html

我无法处理此查询字符串

?full-tang-polished-samurai-katana-sword.html

请帮帮我

1 个答案:

答案 0 :(得分:0)

最后我解决了这个问题,代码如下

RedirectMatch 301 ^/full-tang-polished-samurai-katana-sword.html$  http://www.example.com/final-fantasy-advent-children-cloud-buster-sword.html
RewriteCond %{QUERY_STRING} ^full-tang-polished-samurai-katana-sword.html$
RewriteRule ^(.*)$ http://www.example.com/final-fantasy-advent-children-cloud-buster-sword.html? [R=301,L]