apache下只用。htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|css|themes|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
nginx不支持rewriteCond,nginx配置方法:
server {
listen 80;
server_name act;
location / {
root D:/ci_act;
index index.html index.htm index.php;
autoindex on;
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|css|themes|images|robots\.txt)(.*)$ /index.php/$1 last;
}
location ~ ^(.+\.php)(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED D:/ci_act$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME D:/ci_act$fastcgi_script_name;
include fastcgi_params;
}
}