Showing posts with label remove index.php. Show all posts
Showing posts with label remove index.php. Show all posts

Tuesday, March 3, 2015

remove index.php from url codeigniter

If you don't know  how to setup your codeigniter project click here 

Create .htaccess(including the dot) in your project root folder



Go through below procedure

By default index.php file will be included in your url. 

       http://localhost/codeigniter/index.php/first                   

       Sample project code  click here
   
You can easily remove this file by using  .htaccess file writing some rewrite rules. 
put below code inside your .htaccess file.


<IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond $1 !^(index\.php)
     RewriteRule ^(.*)$ /codeigniter/index.php/$1 [L]
</IfModule>

   
step-1  RewriteCond $1 !^(index\.php|images|css|js|robots\.txt) give permission using Rewrite Rule i.e. jsjavascript library ), images etc.




step-2  Replace codeigniter(application name) with your application name .
Run your project now you can see in the url index.php is removed.

       http://localhost/codeigniter/first

Thanks for visiting my blog, help your friends by sharing this post.