打开apache的配置文件,conf/httpd.conf :
LoadModule rewrite_module modules/mod_rewrite.so
将相关.htaccess
CI 目录下
index位于根目录时,你可以在index.php所在的根目录里新建.htaccess文件并使用以下代码:
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
当index.php不在根目录时,你可以在index.php所在目录里新建.htaccess文件并使用以下代码:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txtl)
RewriteRule ^(.*)$ /path_to_app/index.php?/$1 [L]
注意把path_to_app换成你的index.php所在文件的目录.假设你的index.php放在根目录的tool子文件夹下,你可以这样写:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txtl)
RewriteRule ^(.*)$ /tool/index.php?/$1 [L]