Remove index.php in Codeigniter

How to remove index.php in the url of codeigniter. here is a simple step to do it.
You can remove it using .htaccess

1
2
3
4
5
6
7
RewriteEngine on
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
 
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

Write this code then save the file into .htaccess, then put the .htaccess file same directory in you index.php or the CI system folder etc.
Go to system > application > config, open config.php and set index_page into nothing.

1
$config[index_page]="";

Before: http://ww.yourdomain.com/index.php/example

After: http://ww.yourdomain.com/example

Share/Save

Go to Original Source