在使用CodeIgniter开发了许多站点之后,我通常会包含一个.htaccess文件来删除URL的“index.php”组件。
以前从没出过问题。
我的新网站使用我的“标准”.htaccess文件
.htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|uploads)
RewriteRule ^(.*)$ /index.php/$1 [L]重写规则应该接受不以“index.php”或“uploads”开头的任何请求,并将其附加到“index.php”的末尾--例如:
1:http://mysite.com/controller -> http://mysite.com/index.php/controller
2:http://mysite.com/anothercontroller -> http://mysite.com/index.php/anothercontroller
它在我的开发服务器(MAMP)上正常工作,但是,我试图使用: Apache2将其上传到服务器上,该服务器由Debian上的VirtualMin控制虚拟主机。
mod_rewrite已在此服务器上启动并运行,因为简单的规则工作如下:
RewriteRule ^old.html$ new.htmlapache错误日志似乎没有显示出任何不合适的地方。
对于为什么在apache2 2/debian/ VirtualMin服务器上不能工作,有什么想法(或者如何使用VirtualMin为虚拟主机打开重写日志,这样我就可以进一步分析)。
干杯:)
编辑I设法找出如何提高VirtualMin中调试的错误级别--这是输出--看起来我得到了递归.?
[Sat Jan 15 09:11:52 2011] [error] [client 110.174.208.166] 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.
[Sat Jan 15 09:11:52 2011] [debug] core.c(3063): [client 110.174.208.166] r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /index.php/
[Sat Jan 15 09:11:52 2011] [debug] core.c(3069): [client 110.174.208.166] redirected from r->uri = /发布于 2011-01-17 07:55:53
好的..。那么多小时后,我找到了我的解决方案。
首先,我想向自己证明那不是Debian,所以我
好吧--所以不是Debian + Apache --然后我在Apache下的VPS上设置了虚拟主机--仍然工作得很好。
回到VirtualMin + Apache + Debian
好的..。因此,这与VirtualMin‘编写’虚拟主机.conf文件的方式有关。
仔细地逐个注释掉文件,我发现了<Directory /home/example-domain/public_html>部分下面的冒犯行:
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/epeau/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/epeau/fcgi-bin/php5.fcgi .php5注释掉这四行,一切都如愿以偿。由于某些原因,使用FastCGI似乎会导致问题。
发布于 2011-01-15 22:01:22
Virtualmin配置标准Apache。在Virtualmin系统上重写规则与任何其他Apache配置没有什么不同。Virtualmin系统中的web服务器是Apache。所以,不要为您的问题寻找"Virtualmin解决方案“;这个问题与Virtualmin无关(虽然Virtualmin确实有一些UI工具来编辑和修改htaccess文件和重写规则等等,但是您不需要使用它们,而且它们与您在htaccess文件中手动执行的操作没有任何神奇或不同之处)。
比较您在开发系统上的实际httpd.conf与您的生产system...something是不同的。您的操作系统更有可能是默认配置差异的根源。
例如,检查以确保htaccess允许您尝试使用的所有指令。可以限制htaccess文件可以配置的功能,我怀疑Debian默认配置在默认情况下比MAMP严格得多。您可能会在所讨论的虚拟主机的error.log中看到一些错误,或者在主error.log中看到一些错误。
发布于 2011-01-16 00:16:10
你考虑过使用FallbackResource吗?
https://stackoverflow.com/questions/4698154
复制相似问题