How do you redirect all non-www links to my website to https://www.
I know that there are a lot of solutions for .htaccess but I haven't been able to find anything sufficient for nginx.
At the moment all I have is
##
# Redirect non-www to www
##
server {
listen 80;
server_name example.com; # add other domains separated by a space as necessary
rewrite ^/(.*)$ https://www.example.com/$1 permanent;
}
which redirects:
example.com
www.example.com
http://example.com
http://www.example.com
to
https://www.example.com
which is what I want, except that https://example.com
doesn't redirect https://www.example.com
How do so how do I get https://
to redirect to https://www.
?