Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 帮助htaccess重写isapi_.htaccess_Mod Rewrite_Redirect_Isapi Rewrite - Fatal编程技术网

.htaccess 帮助htaccess重写isapi

.htaccess 帮助htaccess重写isapi,.htaccess,mod-rewrite,redirect,isapi-rewrite,.htaccess,Mod Rewrite,Redirect,Isapi Rewrite,他们为什么工作???我认为这个问题与第一个问号、第一个等号或数字“39”有关……哈哈记住,重写规则只匹配您的URI,它永远不会匹配主机名或查询字符串。以下是正确的方法来完成您想要做的事情: RewriteRule ^olddomain.php?cat=39$ http://www.newdomain.com/firstdir/seconddir/? [R=301,NC] RewriteRule ^olddomain.php\?cat\=39$ http://www.newdomain.com/f

他们为什么工作???我认为这个问题与第一个问号、第一个等号或数字“39”有关……哈哈

记住,重写规则只匹配您的URI,它永远不会匹配主机名或查询字符串。以下是正确的方法来完成您想要做的事情:

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]

我是白痴。。。我很抱歉。我的问题是,为什么它们都不起作用呢。这很糟糕,但至少现在我明白了。非常感谢你
Options +FollowSymlinks -MultiViews
RewriteEngine on

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