Enabling .htaccess file to rewrite path (not working)

1.

You have to go to /etc/apache2/apache2.conf.
You have to edit that one(you should have root permission).
Change directory text like this

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

2.

sudo a2enconf httpd

3.

Restart Apache2
sudo service apache2 restart

or

sudo service apache2 reload
Done!