Networknet archive Blog

Ubuntu JeOS: Enable Apache2 mod_rewrite

Originally published

By Ivan Versluis

Ubuntu LogoWhile building and testing an Ubuntu JeOS 8.04 virtual machine, I encountered a problem with mod_rewrite. I migrated one of my WordPress blogs to the new VM. The main page and administration area worked, but other pages returned “page could not be displayed”. After checking .htaccess and reconfiguring WordPress options, I found that rewriting was not working in Apache2.

The problem was Apache2’s rewrite configuration. These are the steps I used to get mod_rewrite working on Ubuntu JeOS 8.04:

  1. Shell1 line
    1
    
    sudo a2enmod rewrite
  2. Shell1 line
    1
    
    sudo nano /etc/apache2/sites-enabled/000-default
  3. Change AllowOverride None to AllowOverride All for <Directory /> and <Directory /var/www/>apache2 mod_rewrite 000-default
  4. Restart the Apache2 services:
    Shell1 line
    1
    
    sudo /etc/init.d/apache2 restart

That's it!