Remove index.php in codeigniter
There are only two changes required to Remove index.php in codeigniter.
1. Config.php change.
2. Add code in .htaccess file placed at the root of your application.
Remove index.php in codeigniter
Add the above following code in .htaccess file to Remove index.php in codeigniter.
RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
And
go to application/config.php
and change :
$config['index_page'] = 'index.php';
to
$config['index_page'] = '';
Or You Can Use Also :
DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
.htaccess is placed at the root of your application.
After Adding the above changes index.php will be removed in codeigniter.
Advertisements