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]

Categories: web development codeigniter

Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 20 Days

Crash : 7 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 7 Month

Fastrack : 4 Month

Crash : 2 Month

Related Blogs

Request For Demo