How to Remove index.php from CodeIgniter
In CodeIgniter, by default, it takes index.php in URL, but for digital marketing or SEO purpose google recommend URL should be clean then we need to remove index.php from CodeIgniter URLs. Here we will see the following steps to remove index.php from the URL:
Step1: First, Go to config>config.php file and edit the following;
// Find the below code
$config['index_page'] = "index.php"
// Remove index.php
$config['index_page'] = ""
Step2: In the second step, you have to create a .htaccess file in the root directory where your index.php file is and write the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]