These instructions enable you to configure apache2 to support Drupal's Clean URLs for a default lenny backports installation of drupal 6 (currently drupal6 6.16-1~bpo50+1). Therefore, these instructions should also cleanly work for Debian Squeeze (currently in testing). The default installation serves drupal 6 as http://localhost/drupal6/. These instructions may work for earlier versions of Drupal 6 on Lenny and possibly Etch and possibly Ubuntu versions. Please comment if you have success with these other versions.
For information about Debian Backports, visit http://www.backports.org/.
To enable Clean URLs in the defalt configuration, first, ensure that the apache2 "Rewrite Module" is enabled:
sudo a2enmod rewrite
Next, edit one and only one file,
/etc/apache2/conf.d/drupal6.conf, and make these mods within the
<Directory> block (careful, this file is a symlink: /etc/apache2/conf.d/drupal6.conf -> /etc/drupal/6/apache.conf):
- Add the Rewrite Module directive
RewriteBase, setting it to
Includethe default drupal 6 .httaccess file,
/etc/apache2/conf.d/drupal6.conf file will now look like this (changes in bold-italic):
Alias /drupal6 /usr/share/drupal6
# AllowOverride All
allow from all
After changing the file, restart apache2 with the command:
sudo /etc/init.d/apache2 restart
Then navigate to your drupal adminstrative site configuration Clean URLs page, ensure that the system is correctly configured, and then enable Clean URLs and test.
AllowOveride to None and including the
.htaccess file within the
<Directory> means that Apache2 will only load the .htaccess file once (at startup).
I recommend against the practice of adding more
AllowOveride All directives because this will cause apache2 to read the
.htaccess file on every web request, instead of just once on startup.
RewriteBase /drupal6 directive appears as a comment in the
/usr/share/drupal6/.htaccess file, but I recommend putting the directive in the conf.d/drupal6.conf file because why change more config files than necessary?