October 20, 2013 — kyle.huynh205
Remove index.php from URL in Codeigniter
In order to remove index.php from URL when working in Codeigniter framework, you have to make sure .htaccess exsisted. If it’s not, you have to create in the root directory of your project. Then paste the following source code in the file:
RewriteEngine on
# Prevent CI index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
# Prevent user access to the CI system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Prevent user access to the CI application folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]