Virtual Appliances’ LAMP, WordPress and mod_rewrite

I’ve been a big fan of VirtualAppliances‘ virtual machines for awhile now and have used its LAMP appliance for a variety of low-power applications, but I’ve wondered why it doesn’t ship with mod_rewrite enabled, and why there’s always a step missing from turning it on.

First up, we need to symbolically link the module from /etc/apache2/mods-available to /etc/apache2/mods-enabled:

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

That’s usually what all the online guides mention, but there’s still one more step — one I always forget… we need to edit the default site to allow .htaccess to control the mod_rewrite rules…

So, go into /etc/apache2/sites-available

Edit the default site definition, and make sure you change the AllowOverride to ALL in the /var/www/html section:
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

… and now your WordPress permanent links will work. 🙂