2011-12-28 74 views
0

这里是我的Apache重写规则:没有查询字符串的Apache重定向?

RewriteCond %{QUERY_STRING} cate_id\=(\d+) 
RewriteRule ^cate.php$ category-%1-b0.html [R=301,L] 

我想重定向cate.php cate_id = 72类别的72 b0.html,但它重定向到类-72-B0? .html?cate_2 = 72,我不希望在.html之后查询字符串,是否有无论如何删除它?

回答

2

尝试:

RewriteRule ^cate.php/.*$ category-%1-b0.html? [R=301,L] 
+0

它的工作原理!谢谢你,你真好~~~ – missingcat92 2011-12-28 06:35:12

1

试试这个: “?” 请注意在RewriteRule的末尾。

RewriteEngine On 
RewriteCond %{QUERY_STRING} cate_id\=(\d+) 
RewriteRule ^cate.php$ category-%1-b0.html? [R=301,L]