Apache2 and .htaccess with mod_rewrite on Ubuntu 8.04 (Hardy Heron)

by vivin

Apparently the default settings for .htaccess files and URL rewrites in Ubuntu (8.04 anyway) is kinda jacked. Apache wasn’t seeing my .htaccess files, and even after setting up the configuration correctly, I was getting Internal Server (500) errors from .htaccess files.

The default setting for Apache2 on Ubuntu for .htaccess is “ignore it”. You need to enable it by going to /etc/apache2/sites-available/default and changing the AllowOverride directive, which you can find inside the <Directory> … </Directory> tags:

AllowOverride ALL

If you want to enable URL rewrites, you need to enable the mod_rewrite module as it is not enabled by default:

[11:31:14] vivin@dauntless ~/Projects/www/skyblue
$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

[11:31:20] vivin@dauntless ~/Projects/www/skyblue
$ sudo /etc/init.d/apache2 force-reload
 * Reloading web server config apache2