0

I have some SEO to do on my site. I'd like that the page 'red-bags' point to the search page 'search.php?keyword=red bags' In addittion I'd like that the old search page makes a 301 redir to the new red-bags.

RewriteBase /
RewriteRule ^red-bags /search\.php/keyword=red\sbags [NC,L]

RewriteCond %{QUERY_STRING} keyword=red\sbags
RewriteRule ^search.php http://www.mysite.com/red-bags [R=301,L]

The second rules not work. Please help.

4

1 回答 1

0

尝试将第二条规则更改为:

RewriteCond %{QUERY_STRING} keyword=red%20bags
RewriteRule ^search.php http://www.mysite.com/red-bags? [R=301,L]

在第一行中,空格更改为 urlencoded %20 red-bags 末尾的问号会去除查询字符串,否则它会自动附加到新的 url。

于 2013-06-13T19:31:34.297 回答