1

Trying to understand how to make the redirect to redirect all http traffic to https on lighttpd webserver using 301.

For instance http://www.example.com should redirect to https://www.example.com and it should work for all sub pages as it's basically rewrite to https.

2

After some additional search I found a solution. Added to lighttpd.conf restarted and everything works as expected.

$HTTP["scheme"] == "http" {
# capture vhost name with regex conditiona -> %0 in redirect pattern
# must be the most inner block to the redirect rule
    $HTTP["host"] =~ ".*" {
        url.redirect = (".*" => "https://%0$0")
    }
}
0

I think you did a typo because you wrote from http://mydomain should redirect to http://mydomain, I think you mean to https://mydomain.

I hope this will help you. I have used this Information for my NGINX Webserver:

HSTS on Lightpttd - Turtorial

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.