在.htaccess中配置rewrite后出现500错误的问题

之前在.htaccess中配置了rewrite后,总是会出现服务器500错误,检查过原因:

1.不是httpd.conf中没有loadModule mod_rewrite

2.也不是Directory 指令AllowOverride None的问题

3.更不是我写的.htaccess中语法的问题

 

我的.htacess是这样写的,

写道
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /rewrite
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
 

 

/rewrite/webroot这个目录已经存在了,但仍出错,查看apache error log是这样:

写道
[Fri Oct 31 10:23:01 2008] [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.
[Fri Oct 31 10:23:01 2008] [debug] core.c(3046): [client 127.0.0.1] r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/webroot/index.html
[Fri Oct 31 10:23:01 2008] [debug] core.c(3052): [client 127.0.0.1] redirected from r->uri = /rewrite/index.html
 

后来我试了试在/rewrite/webroot中也写一个.htaccess文件:

写道
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /rewrite/webroot
</IfModule>

 然后居然能访问成功了,难道还需要在rewrite的各个子目录中也添加.htaccess?

虽然现在我要的功能实现了,可是还是有点迷惑,不知谁可帮我解解惑。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值