13 November, 2006

Wordpress and lighttpd

In setting up this new hosting environment, I decided to go with lighttpd to handle webserving duties, as opposed to Apache. All-in-all, I'm quite happy with lighty. It's pretty damn fast, and the configuration file is both easy and amazingly powerful.

Of course, one of the things that lighty is missing is an .htaccess-type file. And some of Apache's more powerful rewriting capabilities. In particular, the ability to see if a file or directory actually exists, and then rewrite the URL based on that. All of this, of course, would be particularly helpful in setting up Wordpress, with its "clean" URLs.

Most of the solutions that I have seen to this problem involve a lot of lines of rewriting individual, hard-coded filenames. For me, not terribly optimal, especially since I'm mainly looking to rewrite things like http://blog.jgumby.com/something-that-doesnt-really-exist/ into http://blog.jgumby.com/index.php/something-that-doesnt-really-exist. So, basically, my feeds, archives, &c. What I've come up with is the following:

"^/(wp-.+)" => "$1",
"^/(.+)/$" => "/index.php/$1",
"^/(.+)/(.+)$" => "/index.php/$1/$2"


And that's it. I'm sure I'll find that I've missed something really obvious, particularly with a feature of Wordpress that I just don't use very much. But I'll cross that bridge once I get there. The main thing to remember is that if you have other directories in your Wordpress install directory that do actually exist, you'll have to add entries for them (or just modify the first line to include them, you regex guru).

No comments:

Post a Comment