Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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_Redirect_Mod Rewrite_Url Rewriting - Fatal编程技术网

.htaccess 重写秒。太多的内部重定向。限制内部递归。

.htaccess 重写秒。太多的内部重定向。限制内部递归。,.htaccess,redirect,mod-rewrite,url-rewriting,.htaccess,Redirect,Mod Rewrite,Url Rewriting,此代码的行为与条件的顺序不同: 此代码有效 RewriteCond %{HTTP_HOST} ^(www.)?mypage.com$ [NC] RewriteCond %{REQUEST_URI} !test/[NC] RewriteCond %{REQUEST_URI} !x/ [NC] RewriteCond %{REQUEST_URI} !test2/ [NC] RewriteRule ^(.*)$ /test2/$1 [L] 这一个不起作用-内部服务器错误550- RewriteCon

此代码的行为与条件的顺序不同:

此代码有效

RewriteCond %{HTTP_HOST} ^(www.)?mypage.com$ [NC]
RewriteCond %{REQUEST_URI} !test/[NC]
RewriteCond %{REQUEST_URI} !x/ [NC]
RewriteCond %{REQUEST_URI} !test2/ [NC]
RewriteRule ^(.*)$ /test2/$1 [L]
这一个不起作用-内部服务器错误550-

RewriteCond %{HTTP_HOST} ^(www.)?mypage.com$ [NC]
RewriteCond %{REQUEST_URI} !test2/[NC]
RewriteCond %{REQUEST_URI} !x/ [NC]
RewriteCond %{REQUEST_URI} !test/ [NC]
RewriteRule ^(.*)$ /test2/$1 [L]
服务器日志:

由于可能的配置错误,请求超出了10个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制


这是怎么形成的?为什么只有其中一种情况?

这只是一个很难注意到的打字错误。其中一个条件中的最终参数之间没有空格

在这里更容易发现:


RewriteCond%{REQUEST\u URI}!foo/[NC]
发生这种情况时,您将键入什么作为URL?内部服务器错误(500)。看起来像是一个重定向循环,我无法理解。