Making Drupals clean URLS work on lighttpd

Lighthttp is a very good alternative for Apache. The exact details on why, how and when are outlined on lighttpd's website, but I choose it for my development environment; because it is light: having five forked apache processes idling around, merely to develop a simple module is way OTT, I think.

There are many tutorials on getting lighttpd up and running, including a nice, yet complex one special for Drupal.

I found that Ubuntu's vanilla lighttpd in served Drupal Just Fine[tm], except for the clean urls. Which is not hard to get working either.

  1. Edit /etc/lighttpd/lighttpd.conf and uncomment the "mod_rewrite", rule in the top setting server.modules.
  2. Run sudo lighty-enable-mod rewrite to enable the module
  3. Create a new file ls /etc/lighttpd/conf-available/10-rewrite.conf And add the contents of this file there (or download it and save it as the file mentioned above)
  4. Restart lighttpd sudo /etc/init.d/lighttpd restart

Now you can access your drupal site(s) on example.com/drupal. Note that the /drupal is virtual, it is not an actual directory. I use that to make sure the rewrite does not try to rewrite all CSS and image urls too. It serves me fine on my development environment.

Lots of thanks go out to darix for online help, and to Remco Brink for providing the proper rewrite ruleset.

About the author: Bèr Kessels is an experienced webdeveloper with a great passion for technology and Open Source. A golden combination to implement that technology in a good and efficient way. Follow @berkes on Twitter. Or read more about Bèr.

blog comments powered by Disqus