Today,  we will learn how to remove index.php from URL in Codeigniter. why are you remove index.php from URL? because when user using create SEO friendly, user readability and easy to understand for the user.

Now, let's start to discuss how to remove index.php from URL in Codeigniter.

Apache setting.

First,  we will enable the "mod_rewrite" on apache server. because it gives permission of httacess rewrite, for that we need to enable "mod_rewrite". after enable then restart the apache server.

Updating Config file

After then we will update the below configuration setting in the "application/config/config.php" directory.

$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";

Creating httacess file

Finally,  we will create htaccess file and paste the below code in this file and that file put on the root directory project.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>