We currently use the following method to perform an http to https
rewrite.
rewrite ^ https://$server_name$request_uri permanent;
I am planning to change it to the preferred method of:
return 301 https://$server_name$request_uri;
However, we’d like to also make sure any requests for domain.com are
sent to
www.domain.com, whether someone tries to access domain.com via http or
https.
How would I write the redirect statement to rewrite http:// to https://
but
also rewrite domain.com to www.domain.com?
Posted at Nginx Forum: