1
每當我嘗試使用我的.htaccess訪問不存在的文件/文件夾時,它將在日誌中返回500錯誤而不是404以及以下消息:來自不存在的文件/文件夾的錯誤
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 mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)/*$ /$1.php?p=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/*$ /$1.php [L]
</IfModule>
的代碼轉換網址如下:
http://mysite.com/about -> http://mysite.com/about.php
http://mysite.com/something/else -> http://mysite.com/something.php?p=else
一個網址CA使用錯誤真的是任何服務器無法找到例如:
http://mysite.com/Idontexist.php
http://mysite.com/nosuchfolder
有誰知道如何防止這種情況?
你能用英文解釋你的.htaccess文件正在做什麼,然後顯示一個表現出這種行爲的URL嗎?很明顯,你的.htaccess文件正在導致重定向循環。 –
@TobyAllen我用它做了什麼更新了這個問題。 – lemondrop