开发者

help htaccess isapi rewrite

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 ^olddom开发者_如何学Cain.php\?cat=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC]

why they work??? the issue i think has something to do with the first question mark, the first equal sign, or the digits '39'...haha


Remember RewriteRule matches only your URI and it will never match the host name or query string. Here is the right way to do what you are trying to do:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^cat=(.*)$
RewriteRule ^olddomain\.php$ http://www.newdomain.com/firstdir/seconddir/? [L,R=301,NC,NE]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜