Enabling Mod-Rewrite for Apache Webserver on Linux Ubuntu


02.03.2014 | PhilVanB | Programmierung | Apache

Mod-Rewrite is a software-modul for the Apache webserver. It's basically used in webdevelopment to modify the appearence of a web URL. That way an URL for example becomes search engine friendly.

http://example.com/index.php?title=page-title

could be rewritten as:

http://example.com/page-title

Now, to use Mod-Rewrite run the following command in the terminal:

sudo a2enmod rewrite

Then open the apache2 config file named default with an editor of your choice:

sudo nano /etc/apache2/sites-available/default

Go to the line where it says /var/www/ “AllowOverride None” and change it to “AllowOverride All”. Last but not least restart the Apache Webserver:

service apache2 restart

That’s it! Now you should be able to use Mod-Rewrite.