2011-05-03 160 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