httpd.conf
找到LoadModule rewrite_module modules/mod_rewrite.so这行,把该行前的#去掉。
找到LoadModule rewrite_module modules/mod_rewrite.so这行,把该行前的#去掉。
CI根目录,新建.htaccess文件
RewriteEngine on
RewriteCond $1 !^(index\.php|style|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
如果你的目录不是根目录。比如我的URL为http://localhost/ci,则最后一行要改为RewriteRule ^(.*)$ /ci/index.php/$1 [L]
最后到CI目录下的config文件夹下,在config.php文件中,
将$config['index_page'] = "index.php"; 修改为 $config['index_page'] = "";
最后重启Apache 服务器,再次访问,就不需要输入index.php了