簡體   English   中英

如何解決此mod_rewrite規則中的無限循環?

[英]How to fix infinite loop in this mod_rewrite rule?

我在.htaccess有以下內容。 文件:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/css(/?|/.+)$
RewriteCond %{REQUEST_URI} !^/js(/?|/.+)$
RewriteCond %{REQUEST_URI} !^/img(/?|/.+)$
RewriteRule !^/handle\.php$ /handle.php [L]

我只是希望將所有請求(以/css//js//img/開頭的請求除外)發送到handle.php

但是,當我發出請求時,出現500錯誤,並且此錯誤記錄在錯誤日志中:

[Sat Mar 24 16:14:53 2012] [error] [client xxxx] 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.

為什么會陷入無限循環?

可能是將請求重寫為/handle.php不匹配!^/handle\\.php$ ,因此它嘗試重寫該重寫,等等。您的問題可能是斜杠嗎? 嘗試玩一下。

如果不是,請檢出RewriteLog指令(並在其下方查看RewriteLogLevel條目)。 您將能夠查看正在嘗試進行哪些重寫,並且您可能能夠找出問題所在。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM