Monday, August 5, 2013

Removing the index.php file from url in codeigniter

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 file by using a .htaccess file with some simple rules.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
This htaccess rule is little different than rule you can find in Codeigniter's own website. When I used the codeigniters htaccess rule, it didn't worked. After searching the solution I found above solution. It worked. :)

No comments:

Post a Comment