CI 3.0 隐藏index.php

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013939884/article/details/70482289

修改apache httpd.conf文件

这行去掉注释#
LoadModule rewrite_module modules/mod_rewrite.so

第一步:
修改
<Directory />
    AllowOverride none
    Require all denied
</Directory>
为
<Directory />
    AllowOverride all
    Require all denied
</Directory>

第二步:

CI根目录添加.htaccess文件
RewriteEngine on
RewriteCond $1 !^(index\.php|style|robots\.txt)
RewriteRule ^(.*)$ /i1894/index.php/$1 [L]

当然如果你的目录不是根目录,则要注意,比如我的URLhttp://localhost/ci,则最后一行要改为RewriteRule ^(.*)$ /ci/index.php/$1 [L]

最后一步:
修改config.php文件

$config['index_page'] = "index.php"; 
修改为 
$config['index_page'] = ""

重启apache服务器,大功告成。

猜你喜欢

转载自blog.csdn.net/u013939884/article/details/70482289
今日推荐