Redirect https to https://www
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Redirect https to https://www
Hello All,
need some advise in redirecting my SSL domain properly. I have the Certiuficates in place. This is what I have in the Configs
/home/admin/conf/web/nginx.conf
/home/admin/conf/web/snginx.conf
Now this is the scene when I type the URL:
domain.com redirects properly to https://www.domain.com
but
typing in https://domain.com (non-www) does NOT redirect to https://www.domain.com.
Am I doing it in correctly ?
need some advise in redirecting my SSL domain properly. I have the Certiuficates in place. This is what I have in the Configs
/home/admin/conf/web/nginx.conf
Code: Select all
server {
listen 111.222.333.444:80 ;
server_name domain.com www.domain.com;
return 301 https://www.$server_name$request_uri;
/home/admin/conf/web/snginx.conf
Code: Select all
server {
listen 111.222.333.444:443 ssl http2;
server_name domain.com www.domain.com;
domain.com redirects properly to https://www.domain.com
but
typing in https://domain.com (non-www) does NOT redirect to https://www.domain.com.
Am I doing it in correctly ?
Re: Redirect https to https://www
https://vestacp.com/docs/#how-to-redirect-http-https
https://vestacp.com/docs/#how-to-force-https
http://nginx.org/en/docs/http/convertin ... rules.html
https://vestacp.com/docs/#how-to-force-https
http://nginx.org/en/docs/http/convertin ... rules.html
Code: Select all
server {
listen 000.000.000.000:80;
server_name www.mydomain.com;
return 301 http://mydomain.com$request_uri;
}
server {
listen 000.000.000.000:80;
server_name mydomain.com;
root /home/user/web/mydomain.com/public_html;
....................................
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Redirect https to https://www
I thought so but Since Vesta creates the server block by default like like
I was hesitant to change it to two different blocks. is that the only way ?
Code: Select all
server_name domain.com www.domain.com
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Redirect https to https://www
Well, I resolved the issue... I think somehow the Cert. generated did not have naked domain covered. Reissued with and all htaccess rules started working. Silly...!
Now I wanted to NOT use htaccess and let nginx redirect to https://www. If I write in the listen 172.110.20.76:443; Server block, it stops the whole site... while the same rule works for nonhttps port 80 correctly. What is wrong in here... any clues ?
Code: Select all
-d www.domain.tld -d domain.tld
Now I wanted to NOT use htaccess and let nginx redirect to https://www. If I write
Code: Select all
return 301 https://www.domain.com$request_uri;