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

Leave a Reply

Related Posts: You may like

Codeigniter pagination with search query string

Minify HTML in CodeIgniter using Hooks

Redirect http to https using htaccess

How to execute mysql query inside codeigniter helper


Crypto Currency

PHPKIDA provides free online the best real-time crypto market price, news, predictions, index with graphs & historical data for 2000+ coins including bitcoin, ethereum, & altcoins from major cryptocurrency exchanges.

Visite Tool

Icon Generator

PHPKIDA provides free online icon generator. Our icon generator help you to edit, modify, resize and customize icon for your website and applications. Convert to a shap you like add icon border, you can change icon border color, border size, background color, icon shadow, icons color, icon size in your own way and save it as a png image.

Visite Tool

Youtube Video Downloader

PHPKIDA provides Free online YouTube video downloader to download YouTube videos quickly in MP4, 3GP, and more. Search your video and free fast download youtube videos.

Visite Tool

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.