17Apr/10
URL rewriting for wordpress and lighttpd

Please note: Since I managed to lose my original database-file for this blog I have tried to recreate this post since quite a few of you found it useful.
In your lighttpd.conf or 10-rewrite.conf enable mod_rewrite and then paste the following code (you will need to edit the $HTTP["host"] though):
$HTTP["host"] =~ "emil.haukeland.name" { url.rewrite-final = ( # Exclude some directories from rewriting "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0", # Exclude .php files at root from rewriting "^/(.*.php)" => "$0", # Handle permalinks and feeds "^/(.*)$" => "/index.php/$1" ) }
These three rules should cover for every plugin and functionality. If you have other folders which you will need to access without any redirection (images in a separate folder etc), you have to add this to the first rule.
Now change the setting in Options->Permalinks to Custom and create your permalink structure. Personally I prefer this:
http://emil.haukeland.name/%category%/%year%/%postname%/