You are here

Getting Drupal's Clean URLs working on a Debian based system

Submitted by Karthik on 1 January, 2007 - 04:28

My default Kubuntu install needed some tweaking to get Clean URLs working (in Drupal 5, Apache 2). This is a quick guide to getting this sorted for other users out there:

First off, the mod_rewrite module isn't enabled by default. To enable it, type
sudo a2enmod

and add rewrite as the module you would like enabled. (You can also enable the expires module which is also used by Drupal, but do it later).

Restart apache:

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

Check if the clean URLs test (in ?q=admin/settings/clean-urls) works. If not, jump to the /etc/apache2/sites-enabled directory and check what your setup is like. By default, you should just see the 000-default link here. (Backup first and) Edit the file:

sudo vi 000-default

Look for the following block of code:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

Change the line AllowOverride None in the above block to AllowOverride All and restart apache again.

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

This should get Clean URLs working.

hth,
-K

P.S. For those of you who still have issues, consider setting the RewriteBase in Drupal's .htaccess to the correct subdirectory (or just a plain / if you aren't running Drupal in a subdirectory).