Lighttpd domain redirection
- by HTF
I would like to redirect domains on HTTP/HTTPS:
http://old.com -> https://new.com
https://old.com -> https://new.com
I have to specify the SSL key/certificate for the old domain but I'm not sure where I have to place these directives:
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/pki/tls/private/new.com.pem"
ssl.ca-file = "/etc/pki/tls/certs/new.com.crt"
}
$SERVER["socket"] == ":80" {
$HTTP["host"] =~ "old.com|new.com" {
url.redirect = ( "^/(.*)" => "https://new.com:443/$1" )
}
}
I was trying to add the code below but Lighttpd reports configuration errors:
$SERVER["socket"] == ":443" {
$HTTP["host"] =~ "old.com" {
url.redirect = ( "^/(.*)" => "https://new.com:443/$1" )
}
ssl.engine = "enable"
ssl.pemfile = "/etc/pki/tls/private/old.com.pem"
ssl.ca-file = "/etc/pki/tls/certs/old.com.crt"
}