Install/Enable Mod-rewrite in apache
In order to use mod_rewrite
you can type the following command in the terminal:
sudo a2enmod rewrite
Restart apache2 after
sudo /etc/init.d/apache2 restart
or
sudo service apache2 restart
or as per new unified System Control Way
sudo systemctl restart apache2
Allow Overrides so the .htacces file works.
In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf
(here we have an example of /srv/www
):
<Directory /srv/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change it to;
<Directory /srv/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
then,
sudo service apache2 restart