【问题标题】:Codeigniter routes not working since changing server更改服务器后 Codeigniter 路由不起作用
【发布时间】:2013-02-28 23:37:15
【问题描述】:

我已将一个 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。

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

【问题讨论】:

  • 抱歉,我无法理解您的问题的性质。你能解释一下什么不起作用以及预期的行为是什么?
  • 尝试删除 index.php 之前的正斜杠。不确定它会有所作为,但值得一试

标签: php .htaccess codeigniter mod-rewrite


【解决方案1】:

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

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-08
    • 2017-02-24
    • 2022-06-24
    • 2016-07-07
    • 2018-06-11
    • 2011-11-07
    相关资源
    最近更新 更多