WordPress permalinks with Lighttpd

       105 words, 1 minutes

By default, WordPress uses “?p=123” like URL.
Those aren’t really pretty and probably not easily useable from web crawler bots… So let’s enhanced this a bit.

As the time of the writing, I’m using WordPress 3.0.1 with Lighttpd 1.4.26 on NetBSD 5.0_STABLE.

First configure WordPress’ permalinks to use a custom syntax ; I choosed: "/%year%%monthnum%%day%/%postname%/"

Then configure Lighttpd :

$HTTP["host"] == "test.tumfatig.net" {  
  var.wpdir = "/wordpress/"  
  url.rewrite-once = (  
    "^" + wpdir + "(wp-.+).*/?" => "$0",  
    "^" + wpdir + "(sitemap.xml)" => "$0",  
    "^" + wpdir + "(xmlrpc.php)" => "$0",  
    "^" + wpdir + "(.+)/?$" => wpdir + "index.php/$1"  
  )  
}

Restart Lighttpd and enjoy!