从codeigniter中的url中删除index.php

时间:2011-10-28 04:45:53

标签: .htaccess codeigniter bluehost

我最近开始使用codeigniter,我在这里托管了Bluehost:http://dev.fuelingtheweb.com/codeigniter/

如果我在这样的路径中包含index.php:/codeigniter/index.php/hello,一切正常,但如果我尝试访问不带index.php的页面,请执行以下操作:/ codeigniter / hello,我得到500内部服务器错误。我尝试过很多.htaccess选项,但似乎没什么用。

目前,我的.htaccess文件位于此处:/ codeigniter/.htaccess,它包含以下代码:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /codeigniter/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)$ codeigniter/index.php/$1 [NC,L,QSA]
</IfModule>

<IfModule !mod_rewrite.c>
  ErrorDocument 404 index.php
</IfModule>

另外,我的配置文件(/codeigniter/application/config/config.php)包括以下内容:

$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

我尝试了所有5种协议选项但没有成功。

对此的任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

您是否尝试过用户指南中的那个?

https://www.codeigniter.com/user_guide/general/urls.html

相关问题