As some of you have read, I recently switched this production web server over to Lighttpd, and so far I am very much impressed. I have been tinkering with Lighttpd for some time, and I really feel it is a fine replacement for Apache. It supports all the same basic modules that I need (mod_rewrite, mod_alias, mod_auth, etc) and uses far less resources. The only difficulty in switching is migrating the configuration and little “tweaks” to get things setup just right.
One thing, for example, is that WordPress assumes an Apache server, or something that supports .htaccess files. This is not the case with Lighttpd, but is solved very, very simply. Early in my migration I read a number of blog posts suggesting solutions to the WordPress Permalink setup, some more complicated than others. I have to say that I think I found the simplest solution, and it is rarely seen on other blogs. Below is one line that will support any WordPress Permalink setup you want:
## Permalink Support:
server.error-handler-404 = "/index.php"
That’s all there is to it. That one line in the lighttpd.conf will handle the permalinks internally and nothing more is required. No dealing with weird regex patterns and trying to exclude this or that. Lighttpd is smart enough to handle it internally with that line.
If you are using a more complex Permalink rewrite configuration in Lighttpd I’d be interested in hearing if this does or does not achieve the same results.