How to remove index.php from Codeigniter URL
If you are using Codeigniter you are noticed that by default index.php will be included with your URL.
But you can easily remove index.php from your CodeIgniter’s URL so that your URL should be like:http://anmsaiful.net/blog/contact
To do this just follows the following steps:
- 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 (where the system directory resides), open the file using your favorite text editor, write down the following script and save it:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ 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

I am A.N.M. Saiful Islam. Open Source Contributor, Professional Web Application Developer and currently working with SYSBD Limited as Project Manager
THANK YOU!!!!
I have searched up and down for this answer. Included codeigniter.com and textbooks – No one has mentioned the editing of $config['uri_protocol']
Thanks man, many other solutions made trouble.
This does not work with Uniform Server on Windows.
Wow !! thanks really helpful. I have been suffering with htaccess. And now it’s working. You rulz
@JG : you need to edit httpd.conf in apache dir to enable mod_rewrite module. I’m uniform server user and CI can work in it seamlessly. give it a try
thank you ,
now my web site is working properly.
the last line should read (you forgot the ? after the index.php):
RewriteRule ^(.*)$ /index.php?/$1 [L]
No need to use the “?” sign…
One more thing your mod_rewrite.so apache module should have to be enabled. Open httpd.conf and change #LoadModule rewrite_module modules/mod_rewrite.so by LoadModule rewrite_module modules/mod_rewrite.so
what name in “.htaccess” ? any name ? please and thank you.