2010-02-12 103 views
0

我的.htaccess文件中有以下两个301重定向。第一个重定向/faq.php工作正常,但第二个刚刚得到一个404错误。任何人都可以提出为什么这可能会发生?.htaccess 301重定向问题

Options +FollowSymLinks 
RewriteEngine on 

redirect 301 /faq.php http://www.mysite.com/faqs 
redirect 301 /reports/index.php?regionid=14 http://www.mysite.com/forecasts/bay-view 

回答

2

由于Apache文档会告诉你,mod_alias和Redirect不支持查询字符串。您需要使用重写规则:

RewriteCond %{QUERY_STRING} (^|&)regionid=14(&|$) 
RewriteRule /reports/index.php http://www.mysite.com/forecasts/bay-view? [R=301]