Hi, In this post i will going to explain about How to write SEO friendly urls in CodeIgniter using .htacess file.

How to write SEO friendly urls in CodeIgniter by Anil Kumar Panigrahi

How to write SEO friendly urls in CodeIgniter by Anil Kumar Panigrahi

create  .htaccess file with the following contents.

1
2
3
4
5
6
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Then url will be

http://localhost/codeIgniter/[controller-name]/[method-name] /

 
It will be useful.

Thank you


7 Comments

srinivas tamada · August 25, 2009 at 8:48 am

Can u provide more example URLs

Vi. · December 4, 2009 at 6:06 pm

It works, thank you 🙂

shankan · October 28, 2011 at 4:47 am

hi, I tried but i couldn’t make this as work..can you send me more information about this. just like whare am i put this .htaccess file? whin i put this on root in host public directory it generated sever error

sojan · November 6, 2011 at 6:56 pm

hmm thanks a lot.. it does work.. just make sure that you set the index page in config option to blank 🙂

n Singh · November 3, 2012 at 8:14 am

its works .. awesome

ram · January 7, 2014 at 12:15 pm

it very simple code.. mokka…. in Tamil

Wordpress homepage not updating with new posts and new theme - Anil Labs · October 17, 2012 at 4:34 pm

[…] code in .htacees file # BEGIN W3TC Page Cache core <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *