Why we should remove index.php?
As CodeIgniter’s URLs are designed to be search engine friendly and to human too. And so to maintain the standards we need to remove the default index.php which appears in the url of codeigniter applications, so that the url becomes search engine friendly and looks clean.
To remove index.php from URL we will use .htaccess file in CodeIgniter. htaccess is the shortened used for Hypertext Access, which is a powerful configuration file that controls the directory “.htaccess”. It is used by Apache based web servers to control various server features.
Steps to Remove index.php using .htaccess-
Step 1: Open the file config.php located in application/config path. Find the below code in config.php file.
Step 2: Remove “index.php”
Step 3: Go to your CodeIgniter folder and create .htaccess file.

As CodeIgniter’s URLs are designed to be search engine friendly and to human too. And so to maintain the standards we need to remove the default index.php which appears in the url of codeigniter applications, so that the url becomes search engine friendly and looks clean.
To remove index.php from URL we will use .htaccess file in CodeIgniter. htaccess is the shortened used for Hypertext Access, which is a powerful configuration file that controls the directory “.htaccess”. It is used by Apache based web servers to control various server features.
Steps to Remove index.php using .htaccess-
Step 1: Open the file config.php located in application/config path. Find the below code in config.php file.
$config[‘index_page’] = “index.php”
Step 2: Remove “index.php”
Step 3: Go to your CodeIgniter folder and create .htaccess file.

Step 4: Write below code in .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Step 5: In some cases the default setting for uri_protocol does not work properly. To solve this issue just open the file config.php again located in application/configand then find the below code.
$config['uri_protocol’] = “AUTO”
Step 6: Replace it as:
$config['uri_protocol’] = “REQUEST_URI”