Enable to rewrite module
# sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
Modify /etc/apache2/apache2.conf
# sudo vi /etc/apache2/apache2.conf
Shift + G
O
# Add to the end of the file
<IfModule mod_rewrite.c>
rewriteEngine On
</IfModule>
:wq
Modify Apache2 site configuration file
Based on apache2 default page
# sudo vi /etc/apache2/sites-enabled/000-default.conf
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
# AllowOverride None >>>>> Change None to All
AllowOverride All
Require all granted
</Directory>
:wq
# sudo service apache2 restart
Finished!