How to enable Rewrite in Apache on Ubuntu

Setting up URL rewrite on Apache is as simple as ABC

Go to the Apache directory, by default it is /etc/apache2

cd /etc/apache2

If you run the 'ls' command, you should see mods-enabled and mods-available directory 

Go to the mods-enabled directory and create a Symbolic link to the rewrite.load file

cd mods-enabled

ln -s /etc/apache2/mods-available/rewrite.load

The next step is to enable URL rewriting on the website

Go to the sites-available folder under /etc/apache2 directory

cd /etc/apache2/sites-available

Edit the site file, assuming the default site is the one, modify the file

sudo vi default

under the <Directory /var/www/> configuration, change the AllowOverride to all

Save the file and restart the Apache server, the URL rewrite gets activated.