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

About Author

My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.

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.