How to write SEO friendly urls in CodeIgniter

in CodeIgniter, SEO / 7 Comments

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.

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

With more than 8 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

Discussion 7 Comments

  1. shankan

    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

  2. sojan

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

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>