【问题标题】:Redirect in my htaccess causing 503 Server Too Busy在我的 htaccess 中重定向导致 503 服务器太忙
【发布时间】:2014-08-15 18:02:31
【问题描述】:

我的服务器上出现了一堆 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>

【问题讨论】:

    标签: linux apache .htaccess mod-rewrite redirect


    【解决方案1】:

    .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]
    

    【讨论】:

      猜你喜欢
      • 2012-11-20
      • 1970-01-01
      • 1970-01-01
      • 2011-07-16
      • 1970-01-01
      • 2021-06-13
      • 1970-01-01
      • 2011-06-15
      • 2020-11-25
      相关资源
      最近更新 更多