Permalinks with Wordpress and lighttpd
It’s really simple to get great permalinks with Wordpress and lighttpd.
The default permalink format leaves you with URLs like http://myblog.com/?p=3. This isn’t great for SEO (showing up as high as possible in Google’s search rankings).
Instead, you want your URL to contain something about the content of your post. We’ll use the title.
Google also favors information closer to the domain name, so http://myblog.com/how-to-eat-figs is better than http://myblog.com/2008/03/18/how-to-eat-figs.
In Wordpress, go to Options -> Permalinks and select “Custom.” Enter this.
/%postname%.html
In your /etc/lighttpd/lighttpd.conf, here’s the section for your blog host. The url.rewrite and server.error-handler-404 sections are the important ones.
$HTTP["host"] =~ "myblog\.com$" { $HTTP["host"] !~ "^www\.myblog\.com$" { url.redirect = ("^/(.*)$" => "http://www.myblog.com/$1") } url.rewrite = ("\.html$" => "/index.php") server.document-root = "/web/myblog/public_html/" server.error-handler-404 = "/index.php?error=404" }
This way, your permalinks end in “.html” so they’re right off your domain and they look like static content. Then your lighttpd.conf takes anything ending in “.html” and routes it to Wordpress.
And now this blog is rolling…