Never been to CodeSnippets 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!)

Lighttpd add/remove www from domain name (See related posts)

Add following configuration directive if you want to redirect www.domain.com to domain.com (no www)

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


Add following configuration directive if you want to redirect domain.com to www.domain.com (force www)
$HTTP["host"] =~ "^domain\.com$" { url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" ) }


Credit goes to Vivek Gite from Nixcraft (http://www.cyberciti.biz/tips/lighttpd-redirect-www-domaincom-to-domain-com.html)

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