Removing index.php from url of codeigniter-3 ubuntu

Removing index.php from url Wamp

To make SEO friendly URL we need to remove "index.php" in Codeigniter. By doing some minor changes in apache and .htaccess file these can done easily.

Please follow below steps:

1) Create .htacess file in parallel to application holder and just copy past the following code:

RewriteEngine On
RewriteBase /IfNoInRootFolderThenFolderName/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

2) Change $config['index_page'] to blank in config.php in application folder as below:

$config['index_page'] = '';

3) Enable "rewrite_module" of apache by executing below command:

sudo a2enmod rewrite

4) Enable "rewrite_module" of apache by executing below command:

sudo service apache2 reload
sudo systemctl restart apache2

5) One more important change in site config file at location /etc/apache2/apache2.conf

In "apache2.conf" look for option "AllowOverride" for folder "/var/www/" and update it as "All"

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Congrats!!! you have configure successfully.

Your feedbacks are most welcome..