帮助htaccess isapi重写


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'有关…哈哈

记住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]

最新更新