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

阅读更多

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

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

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

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

 

我的.htacess是这样写的,

写道

RewriteEngine on
RewriteBase /rewrite
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
 

 

/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文件:

写道

RewriteEngine On
RewriteBase /rewrite/webroot

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

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

你可能感兴趣的:(C,C++,C#,HTML,Apache)