Wednesday, May 27, 2015

[Codeigniter][Resolved] Remove index.php from url

To remove the “index.php” away from url, following the official documents only is not always works. After some searching in google found following a tutorial from Formget.com can do a good jobs and let share here:

Edit Config.php file:
 look for the "application/config/config.php" file, change the value of $config['index_page'] from "index.php" to "".
 From
$config['index_page'] = "index.php"; 
To
$config['index_page'] = "";


And Then change the value of $config['uri_protocol'] from "AUTO" to "REQUEST_URI":



.htaccess
Create an empty files named ".htaccess" at your Codeigniter project root, and paste these code inside the file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 







Reference:
https://ellislab.com/codeigniter/user-guide/general/urls.html
http://www.formget.com/codeigniter-htaccess-remove-index-php/

No comments :

Post a Comment