Master da Web
Back to Blog

Learn how to enable Mod_rewrite in Apache

LucasAugust 9, 20131 min readUpdated on November 4, 2023

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
Share

Need Hosting or Servers?

Discover our VPS, dedicated servers and professional hosting solutions

Related Articles

View all articles