0

我已经将一个 codeigniter 网站投入生产,但我遇到了一个我无法调试的奇怪行为。

我正在使用 mod rewrite 并且所有页面始终指向主页(默认路由),除非我在 url 中使用 index.php。

例子。

mywebsite.com/class/method -> all points to the same page
mywebsite.com/index.php/class/method -> points to the right page.

在配置中: $config['index_page'] = "";

这是我的 htaccess。

RewriteEngine on
RewriteCond $1 !^(index\.php|lib|robots\.txt|upload)
RewriteRule ^(.*)$ /index.php/$1 [L]

网站已从一台服务器复制到另一台服务器 1:1(具有不同的数据库配置)。我越来越绝望,因为我不知道这里发生了什么。在 hte 服务器上启用了 mod_rewrite。

谢谢你的帮助,你会让我免于精神崩溃。

4

1 回答 1

0

几乎放弃后,我发现了问题。

服务器不支持 $_SERVER['PATH_INFO'] 因为它在 apache 中被禁用。

为了快速修复,您可以在 config.php 中将设置更改为 AUTO

另请阅读:Codeigniter $config['uri_protocol'] 问题

于 2013-03-13T10:40:37.160 回答