0
RewriteRule ^olddomain.php?cat=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC]
RewriteRule ^olddomain.php\?cat\=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC] 
RewriteRule ^olddomain.php?cat\=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC]
RewriteRule ^olddomain.php\?cat=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC]

他们为什么工作???我认为这个问题与第一个问号、第一个等号或数字“39”有关……哈哈

4

1 回答 1

1

记住 RewriteRule 只匹配你的 URI,它永远不会匹配主机名或查询字符串。这是做你想做的事情的正确方法:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^cat=(.*)$
RewriteRule ^olddomain\.php$ http://www.newdomain.com/firstdir/seconddir/? [L,R=301,NC,NE]
于 2011-05-03T18:25:20.697 回答