How do I redirect all traffic to the https:// domain?
How do I redirect all traffic to the https:// domain?
Hey guys,
I've setup Vesta and added SSL support for all domains with Let's Encrypt. When manually typing https://domain.com it'll show the site with SSL turned on, but when I just type domain.com it'll always navigate to the non-SSL http:// variant.
How do I make all traffic, per domain or all domains all together (since all domains will have SSL) go automatically to https://domain.com ?
I already googled and saw lots of suggestions, including server {} blocks, which I pasted within the http {} part in the /etc/nginx/nginx.conf file and restarted the server, but that didn't change a thing..
I've setup Vesta and added SSL support for all domains with Let's Encrypt. When manually typing https://domain.com it'll show the site with SSL turned on, but when I just type domain.com it'll always navigate to the non-SSL http:// variant.
How do I make all traffic, per domain or all domains all together (since all domains will have SSL) go automatically to https://domain.com ?
I already googled and saw lots of suggestions, including server {} blocks, which I pasted within the http {} part in the /etc/nginx/nginx.conf file and restarted the server, but that didn't change a thing..
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: How do I redirect all traffic to the https:// domain?
You can do this in htaccess.
https://stackoverflow.com/questions/104 ... h-htaccess
https://stackoverflow.com/questions/104 ... h-htaccess
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]