There are many tutorials for setting up mod_rewrite for Apache, but most of them are missing one critical step. To be honest, I’m writing this as much for myself as I am for anyone else. I’m tired of looking around for the missing step every time I setup mod_rewrite on a new machine. So here it is. First, turn on the rewrite module using this command:
sudo a2enmod rewrite
Next, find the following file and open it as an administrator:
Starting with Ubuntu version 13.10 (I think), this file has been removed and you’ll want to edit the following file instead:
In the /var/www/ section, change:
Finally, restart Apache with the following command:
sudo service apache2 restart
Disclaimer: I tried a bunch of different methods before finally getting mod_rewrite to work properly. I believe these are the only steps that actually made a difference, but there is a slight possibility that something else I did had some effect as well. If these steps don’t work for you, feel free to comment and I’ll see what I can do to help.