How can I enable www subdomain

Hi guys, I want to know how can I enable “www” (https://www.mydomain.com), but keep mydomain.com as primary hostname. I mean, redirecting from “www” to non-“www”, using let’s encrypt.

I found a guide about install nginx after to install discourse from docker, but I’m very noobie, so can anyone help me and explain me all steps. My forum is empty so no problem to reinstall everything if it’s necessary.

ps. Ubuntu 18, digital ocean vps droplet.

I’m pretty sure that wasn’t what he was asking at all @pfaffman … he was asking “how do I automatically redirect visitors to the non-www version of my domain”.

example.com
www.example.com

This is most easily done via the DNS controls where you purchased your domain name from. If your DNS provider doesn’t support redirection, you’re stuck implementing redirects in your webserver.

1 Like

We offer a free service to do it the other way around (and that page also gives some reasons why that is a better idea).

4 Likes

If he points both domains to his Discourse server and he has https on his site he’s fine as long as people hit the http version. Then it’ll do the redirect to https://example.com as desired.

If what he wants is also to have https://www.example.com to redirect to the bare domain, then the instructions I link to provide at least a hint of how to accomplish that. (I’m pretty sure that I did that recently.)

No, that topic is about multisite and multiple domains hosted on the same machine, that is

example.com
foo.org
bar.net

hi again, well, I just created an A record “www” pointing to my droplet’s IP, and apparently it worked fine,

can you give me a feedback if it’s working?

Basically I want force www to non-www, and https: clic here

http://www.kamehouse.net/ – works as you wish
https://www.kamehouse.net/ – is a certificate error

It’s not that likely that someone will stick https in front of the www, so you’re probably in good shape.

edit, can I get a certificate from cerbot just for www w/o install discourse again?

Why not just set up a redirect? There’s no value in having your instance published under two discrete fqdn.

Get your domain off of digitaloceans DNS, and use your domain registrar’s tools to redirect any additional subdomains to the main URL. This doesn’t need to touch your discourse install at all.

3 Likes

I noticed this when you posted it, but today was the first time I had reason to use it. Thanks very much!

1 Like