我已经关注了这个帖子。 Question mark in the end of RewriteRule
我的要求也一样。
我的页面正确地重定向(301),但它显示OBJECT NOT FOUND
http://mydomain.com/iphone_advanced_search_result.php?keywords=test
http://mydomain.com/search/test
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^keywords=(.*)$
RewriteRule ^iphone_advanced_search_result\.php$ search/%1? [R=301,L]`
为什么我收到此错误?请帮助!
答案 0 :(得分:0)
您匹配的网址类似于'/iphone_advanced_search_result.php',但您的实际网址不包含'.php',因此不匹配。
从您的规则中删除'.php'检查,它应该可以正常工作。
答案 1 :(得分:0)
如果用户使用您想要的网址
http://mydomain.com/search/test
,您的处理脚本是
http://mydomain.com/iphone_advanced_search_result.php?keywords=test
你的改写应该如下所示:
RewriteEngine on
RewriteBase /
RewriteRule ^search/(.+)$ iphone_advanced_search_result.php?keywords=$1 [L]