Muhammad Saifullah Muhammad Saifullah - 5 months ago 51
PHP Question

Removing index.php using codeigniter 2

I want to remove the 'index.php' link from the url project folder but it return error 404 Page Not Found.

My default URL is:


and it working just fine. As well for this URL


But, when I put this URL as I remove the index.php:

The code does not work.
Im using codeigniter 2.2.6. The code below is the name of the file and the changes that I have made.

.htaccess at root

RewriteEngine on
RewriteCond $1 !&(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

config.php in 'application' folder

$config['base_url'] = 'http://localhost/training/belajaradmin/';
$config['index_page'] = '';

autoload.php in 'application' folder

$autoload['helper'] = array('url');

routes.php in 'application' folder

$route['default_controller'] = "login";


In .htaccess add following line after RewriteEngine on

RewriteBase    /training/belajaradmin/

Edit config as follows:

$config['base_url'] = ''; 
$config['index_page'] = '';