Sunday, March 9, 2014

How to remove index.php from URLs 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. Here is an example of such a file, using the “negative” method in which everything is redirected except the specified items:you ha


in your root folder where you have htaccess file add this code into htaccess file.


RewriteEngine on
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule .* index.php/$0 [PT,L]

Then Remove index.php from your URL


example.com/index.php/news/article/my_article to example.com/news/article/my_article

 


In the above htaccess , any HTTP request other than those for index.php, images, and robots.txt is treated as a request for your index.php file.



How to remove index.php from URLs In codeigniter

No comments:

Post a Comment