Wednesday, August 8, 2012

Removing index.php from codeigniter URL

Removing index.php from codeigniter URL


Open config.php from system/application/config directory 
 
and replace
 
$config['index_page'] = index.php by $config['index_page'] = “”
 
Create a “.htaccess file in the root of CodeIgniter directory 
 
and add the following lines.
 
RewriteEngine onRewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$1 [L,QSA]
 
In some case the default setting for uri_protocol does not work properly. 
 
 To solve this problem just replace 
 
$config['uri_protocol'] = AUTO by 
 
 $config['uri_protocol'] = REQUEST_URI from system/application/config/config.php

No comments:

Post a Comment