在我的htaccess中重定向导致503 Server Too Busy

时间:2014-08-15 18:02:31

标签: linux apache .htaccess mod-rewrite redirect

我已经在我的服务器上收到了一堆503,但无法弄清楚原因。似乎是重定向相关的,因为我的错误日志膨胀,出现如下错误:

[Fri Aug 15 09:27:09 2014] [error] [client xx.xxx.x.xxx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Fri Aug 15 09:27:09 2014] [debug] core.c(3072): [client xx.xxx.x.xxx] r->uri = /wp/wp/wp/wp/wp/wp/wp/wp/wp/wp/login.php

以下是我的htaccess的内容:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]

Include includes/ul-rewrites.txt

RewriteCond %{HTTP_HOST} !^.*\.xxx\.com
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/(search|newsroom|aboutul|offerings|blog|es|fr).*$
RewriteRule ^(.*)$ http://site.xxx.com/$1 [R=302,L,NE]

RewriteRule . index.php [L]

</IfModule>

1 个答案:

答案 0 :(得分:0)

.htaccess中的违规行是:

RewriteRule ^(.*\.php)$ wp/$1 [L]

服务器收到/login.php的请求并将其重写为/wp/login.php,然后再将其重写为/wp/wp/login.php等等

添加重写条件以排除已正确拥有/ wp /的请求,以解决此问题。例如:

RewriteCondition %{REQUEST_URI} !^/wp/.*$
RewriteRule ^(.*\.php)$ wp/$1 [L]