Drupal Clean Urls on Debian LAMP Stack
Drupal Clean Urls on Debian LAMP Stack


Clean Urls did not work out of the box for me when I installed Drupal on a fresh install of Debian. These are the easy steps for setting them up.

Enable mod_rewrite:
You need to enable the rewrite module so Apache can do the rewrite. On Debian you can issue the following command to do this.

$ a2enmod rewrite

Note: If you are on a different Linux operating system you can basically do the same thing with the following code (the path might be slightly different).

$ cd /etc/apache2/mods-enabled
$ sudo ln -s ../mods-available/rewrite.load rewrite.load

Allow Apache to rewrite:
Now that rewrite is enabled, you need to allow Apache to rewrite the urls in the web root (my web root is ‘/var/www/’). Use your favorite editor and edit the following file (I use vi). You want to change the AllowOverride of your Apache web root from None to All (I am assuming you are installing Drupal in the web root).

Edit the file:

$ vi /etc/apache2/sites-available/default

Change the AllowOverride to All:

# ... stuff here ...
AllowOverride All
#  ... stuff here ...

Now just restart the Apache server and you are good to go…

$ /etc/init.d/apache2 force-reload