Codeigniter – remove index.php

Bootstrap & Apache! you can see the .htaccess

nginx
Add the following lines on your /etc/nginx/sites-enable/domain.com or default.

# removes trailing "index" from all controllers
 if ($request_uri ~* index/?$)
 {
 rewrite ^/(.*)/index/?$ /$1 permanent;
 }

More details how to set up a nginx environment for CI.
http://wiki.nginx.org/Codeigniter

Apache

Create a .htaccess file on the root of your CI installation (in the same directory where you have system, application, etc).

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

 

Awesome tutorial about mod-rewrite / pretty links
http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained

 

Thats kinda it!
Basically is a pretty url rewrite condition, for nginx must be also simple as that.
Simple as that!

Leave a Reply

Your email address will not be published. Required fields are marked *


*