How to Enable mod_rewrite with Apache2 on Ubuntu

When I want to setup a webserver on a fresh virtual machine for testing I use the standard command to install of Apache2, php5, and mysql:

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server phpmyadmin

I am currently playing around with CakePHP which requires mod_rewrite to be enabled. In order to turn this on you need to enter the following commands from any location in the terminal:

sudo a2enmod rewrite

And then just restart the apache2 service:

sudo service apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *