开发者

How do I set up a HTTP to HTTPS redirection for a specific domain in lighttpd?

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.


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 :

  • lighttpd.net - How to redirect HTTP requests to HTTPS
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜