There are 3 steps to remove index.php.
-
Make below changes in
application/config.phpfile$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name'; $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO'; -
Make
.htaccessfile in your root directory using below codeRewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] -
Enable the rewrite engine (if not already enabled)
i. First, initiate it with the following command:
a2enmod rewriteii. Edit the file
/etc/apache2/sites-enabled/000-defaultChange all
AllowOverride NonetoAllowOverride All.Note: In latest version you need to change in
/etc/apache2/apache2.conffileiii. Restart your server with the following command:
sudo /etc/init.d/apache2 restart