默认 ci 框架显示地址是 http://localhost/ci/index.php/test/ 去掉index.php这样会更好些。 1.修改http.conf的 loadmodule rewrite_module modules/mod_rewrite.so 去掉注释 2.ci根目录增加.htaccess文件 ifmodule mod_rewrite.c rewriteengine on rewriteb
默认 ci 框架显示地址是 http://localhost/ci/index.php/test/
去掉index.php这样会更好些。
1.修改http.conf的
loadmodule rewrite_module modules/mod_rewrite.so
去掉注释
2.ci根目录增加.htaccess文件
rewriteengine on rewritebase /ci #removes access to the system folder by users. #additionally this will allow you to create a system.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] #when your application folder isn't in the system folder #this snippet prevents user access to the application folder #submitted by: fabdrol #rename 'application' to your applications folder name. rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] #checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] # if we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # submitted by: elliothaughin errordocument 404 /index.php
.htaccess文件内容
注意winodws下不好直接增加 要有技巧的 可以参看我另一篇文章
3.刷新地址栏
http://localhost/ci/test/ 已经可以看了