我在.htaccess
有以下內容。文件:如何修復這個mod_rewrite規則中的無限循環?
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 x.x.x.x] 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.
爲什麼讓一個無限循環?
你是對的。將最後一行更改爲'RewriteRule!^/handle \ .php $ handle.php [L]'並且它可以工作。謝謝。 – callum 2012-03-24 15:44:10