请求超过了10的限制

我的日志是满的

[Tue Jan 11 10:20:45 2011] [error] [client 99.162.115.123] 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., referer: https://www.domain.com/vehicles/Chevrolet/Uplander/2006

问题是当我启用LogLevel debug我们得到巨大的错误日志,因为我们所有的stream量是SSL。 从我可以告诉该文件不再logging这些错误,或者它是如此埋在SSL日志中,我无法find它们。

这是我的.htaccess

 Options -indexes RewriteEngine On RewriteRule ^battery/([^/]+)$ /browser/product?sku=BATTERY+$1&type=battery RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)/product([0-9]+)$ /browser/index.php?make=$1&model=$2&id=$3&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)/([0-9]+)$ /browser/product.php?make=$1&model=$2&year=$3&id=$4&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)$ /store/product/list.php?make=$1&model=$2&year=$3&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)$ /vehicle/make/model/year/list.php?make=$1&model=$2&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)$ /vehicle/make/model/list.php?make=$1&%{QUERY_STRING} [L,NC] 

首先:永远不要在生产环境中testing这样的事情。 安装testing服务器并在那里执行一个HTTP请求,然后查看日志。 您应该能够轻松识别特定于此请求的内容。

这个debugging数据在解决有关mod_rewriteparsing循环的问题时非常有用。 基本上,它logging它正在做的每一步并打印分辨率。

 RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)$ /store/product/list.php?make=$1&model=$2&year=$3&%{QUERY_STRING} [L,NC] 

这很可能是你想要的这种情况下的规则。 而不是这个效果,分析停止到第二个规则:

 RewriteRule ^battery/([^/]+)$ /browser/product?sku=BATTERY+$1&type=battery RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)/product([0-9]+)$ /browser/index.php?make=$1&model=$2&id=$3&%{QUERY_STRING} [L,NC] 

由于它有[L],最后一个input。 替代将停止在那里。 RewriteRules不关心URL是否匹配。

而是使用RewriteConds来进行匹配。 如果它们匹配,则将使用该规则,如果不匹配,则在该规则之后将继续执行。

所以像

 RewriteCond %{REQUEST_URI} ^vehicles/([^/]+)/([^/]+)/([^/]+)$ RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)$ /store/product/list.php?make=$1&model=$2&year=$3&%{QUERY_STRING} [L,NC] 

你也可以使用在RewriteCond中定义的参数,如果你想清理规则,使用%1。

你可以尝试没有这条线?

RewriteRule ^ vehicles /([^ /] +)/([^ /] +)/([^ /] +)/ product([0-9] +)$ /browser/index.php?make=$1&model= $ 2&id = $ 3&%{QUERY_STRING} [L,NC]

也许它会混淆产品中的额外括号(这只是一个猜测)

根据您的重写规则,与您的url匹配的是:

 RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)$ /store/product/list.php?make=$1&model=$2&year=$3&%{QUERY_STRING} [L,NC] 

这被重新定义为:

 /store/product/list.php?make=Chevrolet&model=Uplander&year=2006& 

正如大家指出的那样,在这一点上,你应该:

通过RewriteLog和RewriteLogLevel启用重写规则的日志logging。 这应该可以帮助你追踪这个问题。 – 1月11日16:50

这样你就可以看到发生了什么,然后你可以在这里发布日志以获得进一步的帮助。

然后请注意,mod_rewrite代码是针对访问代码所在目录下的文件的每个HTTP请求执行的,因此这可能是问题的根源。

你可以使用下面的代码来testingurl是否以.php结尾,如果没有,它将跳过下面的6个RewriteRules。

 RewriteRule !\.php$ - [S=6] RewriteRule ^battery/([^/]+)$ /browser/product?sku=BATTERY+$1&type=battery RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)/product([0-9]+)$ /browser/index.php?make=$1&model=$2&id=$3&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)/([0-9]+)$ /browser/product.php?make=$1&model=$2&year=$3&id=$4&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)/([^/]+)$ /store/product/list.php?make=$1&model=$2&year=$3&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)/([^/]+)$ /vehicle/make/model/year/list.php?make=$1&model=$2&%{QUERY_STRING} [L,NC] RewriteRule ^vehicles/([^/]+)$ /vehicle/make/model/list.php?make=$1&%{QUERY_STRING} [L,NC] 

希望能帮助到你