我在以下重定向时遇到问题。
Redirect 302 /info/index.php?product=xxx http://xyz.com/xxx/
我不明白为什么它不起作用。 我必须转义角色吗?
不能使用Redirect
指令来匹配查询字符串。请改用mod_rewrite
。
将此代码放入DOCUMENT_ROOT/.htaccess
文件中:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^product=([^&]+)
RewriteRule ^index'.php$ http://xyz.com/%1/? [L,NC,R=301]