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

来源:互联网 发布:2010wps软件下载 编辑:程序博客网 时间:2024/05/04 12:50
1、打开Apache配置文件httpd.conf,找到
#LoadModule rewrite_module modules/mod_rewrite.so
去掉前面的#

搜索AllowOverride,将相应Directory下的AllowOverride设置为All

AllowOverride All

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
0 0
原创粉丝点击