Updated from HTTP to HTTPS, Confused About 301 Redirects

I have updated my easyengine site from http to https. All went well except I am confused about the redirections.

I want to set it up so that anything of:

http://www.domain.com http://domain.com https://domain.com

get redirected to:

https://www.domain.com

However at the moment everything HTTP goes to https://domain.com and then to https://www.domain.com (2 redirects).

How can I just get everything that isn’t https://www.domain.com to go to https://www.domain.com ?

I am also confused exactly within the file “ee site edit domain.com” I should put the redirect code.

Thanks

  1. Make sure your WP is configured to have site address with or without www according to your preferences;

  2. edit /etc/nginx/conf.d/force-ssl-domain.com.conf and add or remove the www prefix, according to the step above, from the line:

    return 301 https://domain.com$request_uri; Don’t forget to service nginx reload after editing these configurations, as well as cleaning all your caches.

1 Like

Thank you, I had no idea that file existed!