简体   繁体   English

帮助 htaccess isapi 重写

[英]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 ^olddomain.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我认为这个问题与第一个问号、第一个等号或数字“39”有关……哈哈

Remember RewriteRule matches only your URI and it will never match the host name or query string.记住 RewriteRule 只匹配你的 URI,它永远不会匹配主机名或查询字符串。 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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM