views:

16

answers:

1

I would like to redirect specific domains from http to the corresponding https address in lighttpd. I tried out the tutorial on the lighttpd page but there it is not written for a specific domain. This is what I want:

$HTTP["host"] =~ "secure.example.com" {
     server.document-root = "/var/www/secure.example.com"
     // IF NOT SSL, REDIRECT TO SSL
}

Thanks for your help.

+1  A: 

You can use port detection to be sure that your user come from an HTTP URL

$SERVER["socket"] == ":80" {
  $HTTP["host"] =~ "example.org" {
    url.redirect = ( "^/(.*)" => "https://example.org/$1" )
    server.name                 = "example.org" 
  }
}

Resources :

Colin Hebert