0

Remove index.php from url codeigniter

Remove index.php from url codeigniter

Remove index.php from url codeigniter.

In codeigniter framework there is a index.php file included with url. Everyone want to remove the index.php from url and need a pretty and clean url. Before removing index.php url look like following.
http://example.com/index.php/controller/method
We use the php url rewrite functionality to remove index.php from url in codeigniter. We need to write some .htacess rules and some config changes to accomplish this.
Follow the following steps to remove index.php from url in codeigniter
.htacess code
Create an .htacess file add following code and place that file in your root.
Note :- if you have codeigniter in subdirectory change RewriteBase / to RewriteBase /subdir/

Config changes
Go to “application/config/config.php”
Find below code:-

Replace with the below code:-

After making all the above changes you will get pretty and clean url in codeigniter so now url look like:
http://example.com/controller/method
Now above url look pretty, user friendly and also seo friendly. Enjoy now you have completely done to remove index.php from url in codeigniter.

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.