If your CodeIgniter project is mounted on URL that looks like
http://www.example.com/codeigniter-project/
and you want to remove the index.php so that your URL to a some page example a blog page will look like this
http://www.example.com/codeigniter-project/blog/view/1
instead of
http://www.example.com/codeigniter-project/index.php/blog/view/1
Then first you need to make sure that mod_rewrite is enabled in your apache by typing this in the terminal:
sudo a2enmod rewrite sudo service apache2 restart
Then in your CodeIgniter installation folder add an .htaccess containing this:
RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
The last thing you need to do is make sure that in your config.php index_page is blank:
$config[index_page] = ;
Leave a Reply