I have a lighttpd server running which has an SSL certificate installed. I would, due to certain reasons, like to forward all https: //www. requests to http: //www.
My lighttpd code looks like as follows:
$SERVER["socket"] == ":443"
{
ssl.engine = "enable"
ssl.pemfile = "/path/to/pem/file"
ssl.ca-file = "/path/to/ca/file"
HTTP["host"] =~ "^www\.(.*)$" {
url.redirect = ("^/(.*)" => "http://www.%1$1")
}
}
Can you please point out the problem here. Another thing, what is the difference between %1 and $1 ?
Best Answer
I have used this one:
But be careful, some browser keep in mind that a website use
https
. So it will always try to access thehttps
version no matter the redirect that send the webserver. I have tried this case and Firefox / Chrome told me that my website goes into an infite redirect loop. But when I curl my website onhttps
, I got a 301 tohttp
. And onhttp
a 200.So it's hard to test ...
For your second question, it's in the doc: