Apache Remove index.php
1. Edit the conf/httpd.conf configuration file
#LoadModule rewrite_module modules/mod_rewrite.so to remove the # before the line
Also configure allowoverride all under directory
2. Under the CI root directory (that is, under Index.php,system's sibling directory), create a new configuration file named:. htaccess content as follows:
Rewriteengine on
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewritecond $!^ (index\.php|robots\.txt)
Rewriterule ^ (. *) $ index.php/$1
Rewritecond%{request_filename}!-f
Rewriterule ^ (application|modules|plugins|system|themes) index.php/$1 [L]
3. Put system/application/config/config.php $config[' index_page '] = "index.php"; Change to $config[' index_page '] = "";
4. Restart Apache
Nginx Remove index.php
1. Edit the nginx.conf file
Vi/usr/local/xxxxx/nginx/conf/nginx.conf
#nginx去掉index. php
Location/{
Rewrite ^/$/index.php last;
#防止某些文件夹被直接访问
Rewrite ^/(?! index\.php|robots\.txt|uploadedimages|resource|images|js|css|styles|static) (. *) $/index.php/$1 last;
}
2.config/config.php under Configuration $config[' index_page '] = ";
3. Restart Nginx
How to get rid of index.php in CI path