Saturday, January 28, 2012

How to remove index.php in codeigniter

1. Create file .htaccess and copy code below :


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

2. open file application/config/config.php. 
Find word $config['index_page'] = "index.php"; and change to $config['index_page'] = "";

3. Finish.

Make sure your apache has mod_rewrite activated.

If you're running on Apache2 + ubuntu.
Open your terminal and type this command : a2enmod

Have a nice day and happy coding!!

No comments:

Post a Comment