用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1155|回复: 0
收起左侧

[版本 3.x] 去除URL中index.php的实践案例

[复制链接]
发表于 2016-7-9 23:45:34 | 显示全部楼层 |阅读模式
1、apache的http.conf文件,找到mod_rewrite, 将#号去掉;
2、找到documentroot , 将 下面的AllowOverride none 改为 AllowOverride ALL
3、进入项目目录,在index.php的同级文件夹下新建.htaccess,内容为
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
4、进入项目的config的config.php文件,将$config['index_page'] = 'index.php' 改为 $config['index_page'] = '';
5、重启apache即可

本版积分规则