Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you enable mod_rewrite with Apache in Ubuntu 10.04?

I tried copying rewrite.load from /etc/apache2/mods-available to etc/apache2/mods-enabled but that didn't work.

share|improve this question
up vote 16 down vote accepted

Try this: sudo a2enmod rewrite, and then restart apache.

share|improve this answer
It works. Thanks. – Nathan Osman May 8 '10 at 6:28

Obsidian's answer to use a2enmod is the proper solution. andol's method would work, but could break on upgrade. What a2enmod does is simply create a symbolic link, so the following two are the same, both proper, solution:

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


  a2enmod rewrite

However, a2enmod will look for other types of files, some have .conf and possibly others. There's no reason not to learn this command, though it's important to know what is going on in the background.

Copying the file would make any future admin very unpleased with you. :)

share|improve this answer
Well, it's just for local testing, so not a big deal. But ya, a2enmod is just easier anyway. – Nathan Osman May 8 '10 at 19:01

Actually, while being the kind of wrong solution, copying rewrite.load from ./mods-available/ to ./mods-enabled/ should have worked. Did you remember to restart your apache afterwards?

In any case, ./mods-enabled/ should usually contain symlinks to corresponding files in ./mods-available/. This is, as mentioned by Obsidian, easiest handled by the commands a2enmod and a2dismod.

Apart from enabling the module, you will also have to activate the rewriting. Before you can write your RewriteCond:s and RewriteRule:s there has to be a "RewriteEngine On" in that configuration context.

share|improve this answer
That works too. Just remember to set the right permissions on the symlinks in mods-enabled... or you will be pulling your hair out. – Nathan Osman May 8 '10 at 19:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.