2010-09-21 37 views
4

我想重定向特定的域從http到lighttpd中對應的https地址。我嘗試了lighttpd頁面上的教程,但是它不是爲特定的域編寫的。這是我想要的:如何爲lighttpd中的特定域設置HTTP到HTTPS重定向?

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

感謝您的幫助。

回答

3

您可以使用端口檢測,以確保您的用戶來自一個HTTP URL

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

資源: