Thursday, April 3, 2008

Enable mod_rewrite in Apache under Ubuntu

'mod_rewrite' is disabled in default apache2 installation. To enable this, I followed following procedure. Thanks to Lavlu for showing me this.
At first, load mod_rewrite using Apache's mod enable command
# a2enmod rewrite


Then enable mod_rewrite from Apache2's configuration file. In default installation, there should be a 000-dafult file under /etc/apache2/sites-enabled directory. You should modify that. Just make the value 'All' (it should be 'None' by default) to AllowOverride key for '/' and '/var/www/' directory. So, the line will look like -
AllowOverride All



Now force reload Apache configuration
# sudo /etc/init.d/apache2 force-reload

No comments: