How to configure HTTP redirection to HTTPS for a specific domain in lighttpd?

I would like to redirect specific domains from http to the corresponding https address in lighttpd. I tried 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 } 

Thank you for your help.

+4
source share
1 answer

You can use port discovery to make sure your user has an HTTP URL

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

Resources:

+3
source

All Articles