How to setup 301 redirect -non-www to www

I am having a lot of trouble trying to work out how to do this. I would like to redirect non-www to www using 301 redirect.

I am using digitalocean and ubuntu 20.

Can anyone please advise me how to do this. When I try to follow any guides its saying to find the nginx config file but my discourse installation doesn’t seem to have one.

Thank you

You’d indeed have to install nginx on the host. You can follow these instructions :

An easier way may be trying something on the dns level, a CNAME redirection (www to non-www yes, the other way around,:thinking: not sure though)

2 Likes

You might use forcewww.com or see Setting up Let’s Encrypt with Multiple Domains. I don’t recommend adding an external nginx to solve this problem.

2 Likes