Apache 日志:请求超出了 10 个内部重定向的限制
Apache log: Request exceeded the limit of 10 internal redirects
我有一个网页在服务器上工作正常,但在我的新服务器上不工作。 Apache 日志显示 "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."。
我无法修复它。
<IfModule rewrite_module>
RewriteEngine on
RewriteRule ^(.*)\.css$ .css [L]
RewriteRule ^(.*)\.png$ .png [L]
RewriteRule ^(.*)\.jpg$ .jpg [L]
RewriteRule ^(.*)\.gif$ .gif [L]
RewriteRule ^(.*)\.js$ .js [L]
RewriteRule ^(.*)\.swf$ .swf [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)$ index.php?idioma=&codigo= [L]
RewriteRule ^(.*)/(.*)$ index.php?idioma=&codigo= [L]
RewriteRule ^(.*)/$ index.php?idioma= [L]
RewriteRule ^/$ index.php [L]
</IfModule>
这些规则造成无限循环
RewriteRule ^(.*)\.css$ .css [L]
RewriteRule ^(.*)\.png$ .png [L]
RewriteRule ^(.*)\.jpg$ .jpg [L]
RewriteRule ^(.*)\.gif$ .gif [L]
RewriteRule ^(.*)\.js$ .js [L]
RewriteRule ^(.*)\.swf$ .swf [L]
顺便说一下,它们是无用的(因此您可以删除它们)。
您的代码中还有许多 设计 问题(您可以组合多个规则,可以使用限制性更强的正则表达式,可以避免捕获不需要的数据,等等)。
最后,您的 htaccess 将如下所示
<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/[^/]+/([^/]+)/[^/]+/([^/]+)/?[^/]*$ /index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^([^/]+)/([^/]+)/[^/]+/([^/]+)/?[^/]*$ /index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^([^/]+)/([^/]+)/?[^/]*$ /index.php?idioma=&codigo= [L]
RewriteRule ^([^/]+)$ /index.php?idioma= [L]
RewriteRule ^$ /index.php [L]
</IfModule>
我有一个网页在服务器上工作正常,但在我的新服务器上不工作。 Apache 日志显示 "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."。 我无法修复它。
<IfModule rewrite_module>
RewriteEngine on
RewriteRule ^(.*)\.css$ .css [L]
RewriteRule ^(.*)\.png$ .png [L]
RewriteRule ^(.*)\.jpg$ .jpg [L]
RewriteRule ^(.*)\.gif$ .gif [L]
RewriteRule ^(.*)\.js$ .js [L]
RewriteRule ^(.*)\.swf$ .swf [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)$ index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^(.*)/(.*)/(.*)$ index.php?idioma=&codigo= [L]
RewriteRule ^(.*)/(.*)$ index.php?idioma=&codigo= [L]
RewriteRule ^(.*)/$ index.php?idioma= [L]
RewriteRule ^/$ index.php [L]
</IfModule>
这些规则造成无限循环
RewriteRule ^(.*)\.css$ .css [L]
RewriteRule ^(.*)\.png$ .png [L]
RewriteRule ^(.*)\.jpg$ .jpg [L]
RewriteRule ^(.*)\.gif$ .gif [L]
RewriteRule ^(.*)\.js$ .js [L]
RewriteRule ^(.*)\.swf$ .swf [L]
顺便说一下,它们是无用的(因此您可以删除它们)。
您的代码中还有许多 设计 问题(您可以组合多个规则,可以使用限制性更强的正则表达式,可以避免捕获不需要的数据,等等)。
最后,您的 htaccess 将如下所示
<IfModule rewrite_module>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/[^/]+/([^/]+)/[^/]+/([^/]+)/?[^/]*$ /index.php?idioma=&codigo=&subcodigo=&subsubcodigo= [L]
RewriteRule ^([^/]+)/([^/]+)/[^/]+/([^/]+)/?[^/]*$ /index.php?idioma=&codigo=&subcodigo= [L]
RewriteRule ^([^/]+)/([^/]+)/?[^/]*$ /index.php?idioma=&codigo= [L]
RewriteRule ^([^/]+)$ /index.php?idioma= [L]
RewriteRule ^$ /index.php [L]
</IfModule>