Showing posts with label removing. Show all posts
Showing posts with label removing. Show all posts

Wednesday, September 8, 2010

Removing the 'index.php' from the URL of a codeigniter site

UPDATE (9th May 2015): at the time of writing this article, codeigniter was on version 1.7 I guess. Now, in codeigniter version 2.2.2, the official documentation of Codeigniter shows how to achieve this goal very easily. You can refer to the "Removing the index.php file" section in http://www.codeigniter.com/userguide2/general/urls.html page.

By default, the index.php file will be included in your URLs:
example.com/index.php/news/article/my_article
---

You can easily remove this index.php from displaying in the url by using a .htaccess file in your 'codeigniter' root folder and make it look like: example.com/news/article/my_article

Notice the absence of anything infront of the (.) dot in the filename of .htaccess file

Here is an example of such a .htaccess file.