Remove index.php on CodeIgniter using .htacces

By default CodeIgniter framework url will includes index.php, it’s pretty easy to remove index.php from your url to work with CodeIgniter using .htaccess.

I assume that your web server already enable mod_rewrite module (mostly any web hosting already enable it). Create new file .htaccess in your CodeIgniter code root (same level with index.php) as like this.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Save it, and violaa… your CodeIgniter has pretty URL.

Leave a Reply

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