Lighttpd rewrite in wordpress
17 August 2007Permalinks are the good thing (TM) and are easy to remember. Nevertheless, they are not that easy to configure in lighttpd. I’ve found some rewritings on the net, but none of them were working for me. Probably the issue is using Gengo… I’m not really sure. But after all the hassles, short and easy permalinks seem to be working, so check them out, and if you find something is not working, please report :). I’ve already removed the RSS2 feed for the comments (anyway, those weren’t working without the rewriting thing). I’ve also removed the Bloglines thingie… I didn’t like it too much anyway.
So, I’ve written this small rewriting rules for lighttpd, and thought that maybe someone could find them useful. Here you go (yay, prettyprint):
$HTTP["host"] =~ "geeksynapse.net" {
url.rewrite-once = (
"^/blog/(wp-.+)$" => "$0",
"^/blog/xmlrpc.php" => "$0",
"^/blog/sitemap.xml" => "$0",
# The [a-z][a-z] catches the language
# This is a category link
"^/category/([a-z-]*)/([a-z][a-z])" =>
"/blog/index.php?category_name=$1&language=$2",
# Feeds
"^/feed/([a-z][a-z])/" =>
"/?feed=rss2&language=$1",
"^/feed/atom/([a-z][a-z])/" =>
"/?feed=atom&language=$1",
# This is a page
"^/([a-z]+)/([a-z][a-z])/" =>
"/blog/index.php?pagename=$1&language=$2",
# Main page localized
"^/([a-z][a-z])/" => "/blog/index.php?language=$1",
# This is a post
"^/([0-9]+)/([a-z][a-z])/" =>
"/blog/index.php?p=$1&language=$2"
)
}
Have fun.
Updated: Problem detected with 2 letter long pages (like CV)
No comments yet
Leave a Reply
You must be logged in to post a comment.