2011-05-03 93 views
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'有关... haha​​帮助htaccess isapi重写

+0

你的问题是什么? – anubhava 2011-05-03 17:26:58

+0

我在白痴...我很抱歉。我的问题为什么没有人工作? – 2011-05-03 17:56:59

回答

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] 
+0

哦,好的。这很糟糕,但至少现在我明白了。非常感谢你 – 2011-05-03 19:54:44