Codeigniter Index.php Remove using Htaccess [Working]

Code Igniter URL Rewrite


According to Codeigniter Documentation following is the htaccess way to remove index.php from URI.




RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]



But unfortunately above is not working.


But Working htaccess is below.



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

2 Comments

  1. Don't Forget to Change the index_page parameter in config File.

    Go to Your Codeigniter Folder

    application\config\config.php

    Look for $config['index_page'] = 'index.php';


    Change it to

    $config['index_page'] = '';

    ReplyDelete
  2. If you are Using ABove code, then for Forms action, dont use server['php_self'], but use

    ReplyDelete
Previous Post Next Post