从 codeigniter 中的 url 中删除 index.php
我最近开始使用 codeigniter,并将其托管在 Bluehost 上: http://dev.fuelingtheweb.com /codeigniter/。
如果我在路径中包含index.php,如下所示:/codeigniter/index.php/hello,一切正常,但如果我尝试访问没有index.php的页面,如下所示:/codeigniter/hello,我会得到 500 Internal服务器错误。我尝试了许多 .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 个协议选项没有成功。
任何对此的帮助将不胜感激。
I recently started using codeigniter, and I've got it hosted on Bluehost here: http://dev.fuelingtheweb.com/codeigniter/.
If I included index.php in the path like this: /codeigniter/index.php/hello, everything works fine, but if I try to access the page without index.php like this: /codeigniter/hello, I get a 500 Internal Server Error. I have tried numerous .htaccess options, but nothing seems to work.
Currently, my .htaccess file is locating here: /codeigniter/.htaccess and it includes the following code:
<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>
Also, my config file (/codeigniter/application/config/config.php) includes the following:
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
I tried all 5 protocol options with no success.
Any help with this would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尝试过用户指南中的那个吗?
https://www.codeigniter.com/user_guide/general/urls.html
Did you try the one from user guide?
https://www.codeigniter.com/user_guide/general/urls.html