Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Redirect domain.com requests to www.domain.com (See related posts)

Make sure you have mod_redirect in server.modules, then add this to your lighttpd.conf:

$HTTP["host"] =~ "^domain\.com$" {
  url.redirect = (
    "^/(.*)" => "http://www.domain.com/$1",
    ""       => "http://www.domain.com/"
  )
}


I wasn't able to come up with a way to do it in a single rule. It seems that only "" (not even "(.*)") will match the root request.

Comments on this post

cch posts on May 04, 2006 at 19:26
how about "/?(.*)" to do it in a single rule?
cwcoxjr posts on Apr 20, 2007 at 23:33
Or,

url.redirect = (
"^(.*)" => "http://www.domain.com$1",
)

You need to create an account or log in to post comments to this site.


Related Posts