3

在这里,我有 .htaccess 文件:

Options +FollowSymLinks

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule .* index.php [QSA,L]

并且重写有效,但是当我尝试http://site.com/example时,我的 index.php 中没有 path_info 。

我有这个话题https://stackoverflow.com/questions/1442854/codeigniter-problem-with-mod-rewrite-on-apache-1-3但它没有解决我的问题。

所以,这个问题只发生在 apache 1.3 上(在 2.0 上一切正常),我想知道为什么。不幸的是,我也无法访问 httpd.conf (

请帮我。

4

3 回答 3

3

尝试将重写规则更改为:

RewriteRule (.*) index.php [QSA,L,E=PATH_INFO:/$1]
于 2011-12-13T23:15:31.470 回答
1

这与as (没有扩展名)相关mod_negotiation并且能够访问。/index.php/index

解决方案:

a2dismod negotiation

service apache2 restart
于 2012-02-02T12:05:32.543 回答
0

是真实 CGI 可执行文件/PHP 脚本文件名之后的PATH_INFO虚拟路径后缀。
你需要通过一个才能看到它:

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

于 2011-12-13T23:34:52.127 回答