Codeigniter – remove index.php

Bootstrap & Apache! you can see the .htaccess

Add the following lines on your /etc/nginx/sites-enable/ 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.


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


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 *