Dec 23

How to enable Apache mod rewrite in Ubuntu

Actually this probably works for all Linux distributions with Apache 2. Okay enabling mod_rewrite is really easy, you just have to use a2enmod (Apache 2 enable module):

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

To disable an Apache 2 module, you can run:

sudo a2dismod rewrite
sudo /etc/init.d/apache2 restart

That does the reverse.

With mod_rewrite enabled, you can use the .htaccess file.

By the way in your directory permissions, you must set AllowOverride to “all” like this:

<Directory /home/kahwee/projects/whatever>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride all
  Order allow,deny
  allow from all
</Directory>

Hope it helps.

Possibly related:

  1. How to set up VirtualHost in Ubuntu
  2. How to set up VirtualHost in XAMPP for Windows
  3. How to redirect www to no-www in Lighttpd
  4. How to log slow MySQL queries

No comments yet. Leave yours here.


WordPress powered and Django inspired.
Love and elephants come after.
RSS: Posts and comments.