【发布时间】: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