CodeIgniter转义添加index.php /的干净URL

时间:2011-06-03 14:26:27

标签: php codeigniter

我通过.htaccess在CodeIgniter上设置了干净的URL,它们运行正常。有时虽然CI似乎逃脱了它的干净网址并返回index.php / urls。到目前为止,我已将其追踪到:

  • 表单
  • 重定向

2 个答案:

答案 0 :(得分:4)

如果您使用mod_rewrite从网址中删除index.php。您还需要更改config文件以进行重定向或来自,网址不使用index.php。您需要config.php中的$config['index_page'] = "index.php"; to $config['index_page'] = "";进行更改。

请检查该行上方配置文件中的注释:)

答案 1 :(得分:2)

在第29行,在 config.php 文件中:

$config['index_page'] = 'index.php';

删除index.php,如下所示:

$config['index_page'] = '';