How to remove index.php from url in codeignitor

This are the steps to remove index.php from url:

1. Add the file .htaccess in the project folder i.e by side by side of application or system folder or edit if there as:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]


<Files "index.php">
AcceptPathInfo On
</Files>
</IfModule>


2. Save the file. Also in the application/config/config.php changed the line

$config['index_page'] = 'index.php';
to
$config['index_page'] = '';

Comments