run command:
nano /etc/apache2/apache2.conf
Change from "AllowOverride None" to "AllowOverride All"
Save and close
Now run:
a2enmod rewrite
Now run
sudo service apache2 restart
It should work now.
Configuration:
$locationProvider
.html5Mode(true);
.htaccess file in root directory:
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
...