Page 1 of 1

SSL redirect to naked domain only

Posted: Sat Sep 10, 2016 6:06 am
by Harry77
Hi everybody,
I followed this guide https://vestacp.com/docs/#how-to-force-https ,
This works fine but it always remove the "www",
Does anybody faced this problem and found a solution?

I downloaded the files but I don't know if there is something "wrong" there, this is what I found

Code: Select all

server {
    listen      %ip%:%proxy_port%;
    server_name %domain_idn% %alias_idn%;
    location / {
        rewrite ^(.*) https://%domain_idn%$1 permanent;
    }
}

Re: SSL redirect to naked domain only

Posted: Mon Sep 12, 2016 9:08 am
by tjebbeke
In your config you use this code:

Code: Select all

rewrite ^(.*) https://%domain_idn%$1 permanent;
Here you say, rewrite everything to https://yourdomain.com. I think you need to change this to:

Code: Select all

rewrite ^(.*) https://www.%domain_idn%$1 permanent;

Re: SSL redirect to naked domain only

Posted: Wed Sep 14, 2016 5:26 am
by Harry77
I've already tried that, I rebooted but it doesn't work.
Does anyone know how to investigate?
I'm just trying to learn.