这里我有一个。htaccess文件:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [QSA,L]
和重写工作,但没有path_info在我的index.php当我尝试http://site.com/example。
我有这个主题https://stackoverflow.com/questions/1442854/codeigniter-problem-with-mod-rewrite-on-apache-1-3但它没有解决我的问题。
所以,这个问题只发生在apache 1.3上(在2.0上一切都好),我想知道为什么。不幸的是,我也无法访问httpd.conf (
)请帮帮我。
尝试更改您的重写规则为:
RewriteRule (.*) index.php [QSA,L,E=PATH_INFO:/$1]
这与mod_negotiation
和能够访问/index.php
作为/index
(没有扩展名)有关。
解决方案:
a2dismod negotiation
service apache2 restart
PATH_INFO
是实际CGI可执行/PHP脚本文件名之后的虚拟路径后缀。
你需要通过一个才能看到它:
RewriteRule (.*) index.php/$1 [QSA,L]
注意,您也可能需要首先启用该选项:http://httpd.apache.org/docs/2.2/mod/core.html#acceptpathinfo
AcceptPathInfo On
然后,根据PHP SAPI,您可能必须配置PHP .ini,关于--cgi-force-redirect
设置(该设置旨在避免某些设置中的PATH_INFO漏洞)。http://php.net/manual/en/security.cgi-bin.php