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 “www.example.com/index.php”, “www.phpkida.com/index.php/blog/” 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.

www.phpkida.com/index.php/blog/

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

Your email address will not be published. Required fields are marked *

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

Upload and Resize Image and Create Thumbnail Codeigniter

Rename file while uploading in codeigniter

Pagination In CodeIgniter With Example

Upload file with database codeigniter

Simple codeigniter login system

Codeigniter registration system with session

PHPKIDA Offering Free Tools:

INSTA DOWNLOADER

Free online tool to download Instagram videos, photos and save Instagram videos, photos to your device. It's free & easy to use.

Download Now

CURRENCY CONVERTER

Our real time currency converter calculator will convert your money based on current values from around the world. It's free & easy to use.

Convert Now

ROBOST.TXT GEN.

Create robots txt file that help search engines to crawling and indexing your site with help of our free online Robots.txt Generator tool.

Create Now

HTML MINIFIER

Free online tool to minify or compress html code and reduce the size of html code in few clicks. It's free & easy to use.

Minify Now

CSS MINIFIER

Free online tool to minify or compress css code and reduce the size of css code in few clicks. It's free & easy to use.

Minify Now

JAVASCRIPT MINIFIER

Free online tool to minify or compress javascript code and reduce the size of javascript code in few clicks. It's free & easy to use.

Minify Now

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.