Remove index.php from url in Codeigniter using .htaccess


CodeIgniter is one of the best and popular php framework available today. Sometimes we need to remove the default index.php that appears in the url of codeigniter application, so that the url becomes more clean and SEO friendly. With the help of .htaccess file it’s very easy to do so.
Paste the following code into your .htaccess file which is on root folder of website, it will remove default index.php from the url:


RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]