您的位置:首页 > 编程语言 > PHP开发

PHP CI(CodeIgniter) 如何去掉url中的index.php

2014-10-09 14:18 851 查看
1、打开Apache配置文件httpd.conf,找到
#LoadModule rewrite_module modules/mod_rewrite.so
去掉前面的#
搜索AllowOverride,将相应Directory下的AllowOverride设置为All
[code]AllowOverride All
[/code]
2、在CI的根目录下,建立.htaccess文件,文件内容如下
RewriteEngine On

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

3、打开文件application/config/config.php,$config['index_page'] = "index.php";改为$config['index_page'] = "";
$config['index_page'] = "";

4、重启Apache
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: