The Apache mod_rewrite module allows you to rewrite URLs so that they don’t point to the real address of the file and the real name of the file. This is often used to create so-called Friendly URLs.
To activate the mod_rewrite module just use the following command:
$ a2enmod rewrite
Now edit the file referring to the VIrtual Host on which you want mod_rewrite to work, for our example I edited the file referring to the “localhost” domain:
$ vi /etc/apache2/sites-available/default
Look for“AllowOverride None” and change it to“AllowOverride All” for all occurrences.
Restart the Apache server:
$ service apache2 restart
That’s it!
If you want to disable mod_rewrite:
$ a2dismod rewrite