我如何避免index.php从URL在codelgniter [英] How can i avoid index.php from URL in codelgniter
本文介绍了我如何避免index.php从URL在codelgniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用apache服务器,我需要从uri中删除index.php
I am using apache server,I need to remove index.php from uri
推荐答案
打开config.php并替换
Open config.php and replace
$config['index_page'] = "index.php" by $config['index_page'] = ""
在.htaccess文件中添加
In .htaccess file add
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
$ b b
在某些情况下,uri_protocol的默认设置无法正常工作。要解决这个问题,只需在config.php
In some cases the default setting for uri_protocol does not work properly. To solve this problem just replace in config.php
$config['uri_protocol'] = "AUTO" by $config['uri_protocol'] = "REQUEST_URI"
这篇关于我如何避免index.php从URL在codelgniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文