Remove index.php codeigniter

In this tutorial I am going to show how to remove index.php from URL using .htaccess and config file in CodeIgniter. By default codeigniter url setting is like “”, “” But CodeIgniter is seo friendly you can configure URL according to your requirement. so let’s see how can we remove “index.php” from url.

By default, all URLs in CodeIgniter looks like the below.

Step 1. Change basic setting in “application/config/config.php”

Open your project root directory, then open “application” folder then open “config” folder then open config.php and replace $config[‘index_page’] = ‘……’ with below code;

$config['index_page'] = '';

Step 1. Create a .htaccess file inside your project root directory.

Here we are setting simple rules in the .htaccess file, using .htaccess file index.php file can easily be removed from URL in CodeIgniter. To rewrite URLs using HTACCESS, mod_rewrite need to be enabled in your Apache server. Create a .htaccess file in the root directory of your project and place the following code in the .htaccess file.

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

Code Detail:

Publish Date : 16 March 2018
Keywords Using : how to remove index.php in codeigniter using htaccess, how to remove index.php in codeigniter 3, how to remove index.php from codeigniter url in localhost, codeigniter htaccess remove index.php not working, how to remove index php in codeigniter form get, how to remove index.php from url in codeigniter in xampp, codeigniter htaccess localhost, where to put .htaccess file in codeigniter

Mukesh Jakhar - PHP Web Developer
Mukesh Jakhar

This is Mukesh Jakhar. I’m a professional web developer with 3+ years experience. I am always ready for freelance work and i am writing blogs in my free time. I love to learn new technologies and share with others.

I founded PHPKIDA in September 2015. The focus of this website to provide web development tutorials of PHP, WordPress, CodeIgniter, Jquery, MySQL, HMTL, CSS etc and sharing solution to problems which i already solved.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.