mod_rewrite/htaccess 重定向问题! (递归限制)
我正在尝试创建 mod_rewrite 文件,以便在您查看文件时基本上删除所有 .php 扩展名。
这是我的 .htaccess:
RewriteEngine On
DirectoryIndex index.php
ErrorDocument 404 /errors/404.php
ErrorDocument 403 /errors/403.php
ErrorDocument 500 /errors/500.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
现在这是我在尝试随机名称时从 apache 日志中得到的错误:
[Tue Jan 31 17:26:05 2012] [error] [client 127.0.0.1] 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.
[Tue Jan 31 17:26:05 2012] [debug] core.c(3112): [client 127.0.0.1] r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi
我该如何修复它?谢谢
I'm trying to create my mod_rewrite file so that basically all of the .php extensions are removed when you view a file.
Here's my .htaccess:
RewriteEngine On
DirectoryIndex index.php
ErrorDocument 404 /errors/404.php
ErrorDocument 403 /errors/403.php
ErrorDocument 500 /errors/500.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
Now here's the error i get from my apache log when trying a random name:
[Tue Jan 31 17:26:05 2012] [error] [client 127.0.0.1] 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.
[Tue Jan 31 17:26:05 2012] [debug] core.c(3112): [client 127.0.0.1] r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi.php
[Tue Jan 31 17:26:05 2012] [debug] core.c(3118): [client 127.0.0.1] redirected from r->uri = /aboutasdfoi
How do i go about fixing it? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要隐藏
.php
扩展名,请使用以下代码:To hide
.php
extension use this code: