我在.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