Redirect single/multiple domain(s) to your Discourse instance

These instructions aren’t working for me. Is it because the root domain in the Discourse settings is instead of

I’m trying to map to

Also, if I have https enabled, do the instructions need to be tweaked?


we are getting several 404 not found errors in our console due to changes in category names. can we redirect those addresses to an existing address using this tutorial?

really interested in this…any new development ? also if I’m using a CDN, I can’t know my server IP right? Or should I use me A record IP even if it’s not public knowledge ( cloudflare is proxying it, so it’s hidden )

What about redirecting https www to non www? Can’t find a portable way to this with the docker

An easy way -

  1. Go to Cloudflare

  2. Add your domain

  3. Update Cloudflare nameservers

  4. At Cloudflare DNS Page, point IP address to your host. Turn on Cloudflare proxy.
    A - old.tld - hosting IP
    CNAME - www - old.tld

  5. Go to Crypto menu > SSL mode, set Flexible

  6. Go to page rule, create a new forwarder





That’s all.

Now all request from http/https/http-www/https-www of old.tld will goes to https://new.tld domain.


Update DNS Record

Update the A record for the domain(s) you want to redirect to original domain.

It helped and so am sharing. If somebody trying to change the A Record for the route domain. Don’t use * in the hostname but @ in the hostname of Digitalocean DNS management.

Why are you using digital ocean for DNS? It would be out recommendation to stick with your registrar’s DNS unless you’re looking to use specific features which require moving, such as Cloudflare or Route 53.

Not sure what’s the disadvantage of that. But the reason why i do it is using the registrar only for buying domain and leave that alone. Then manage everything in DO. Also their interface looks easy to manage multiple domains and setup.

Here’s my issue:

If I redirect my naked domain -> using the instructions here, I have problems with my ssl certificate not being valid when going to

If I use NakedSSL to redirect -> My cookies and therefore topics read seems to not display accurately.

What is the solution? I am using a docker install on digital ocean.

@techAPJ @codinghorror

You must redirect to the “correct” form that you have certs for. Content cannot be at multiple domains simultaneously, that is a configuration error, and Google will ding you for duplicate content.


Ok. I did get it working using the instructions as above. As you said my certificate probably hadn’t completely switched from the naked domain to the www domain.

However, I still have issues with discourse not remembering what I have read when I return to the root of the site. If I go straight to the root, all messages are shown as unread until I follow the latest and top links. Any idea what may be causing this behaviour?

Can someone please confirm these settings for me?

    - file:
        path: /etc/nginx/conf.d/www_redirect_1.conf
        contents: |
          server {
            listen 80;
            listen 443 ssl;
            return 301$request_uri;

The goal here is to redirect AND to However, provides an SSL error. I’ve tried several different configurations of this but end up in the same place.

1 Like

I suppose it works fine for you now; as the links mentioned are redirecting fine. I suppose you had to specify ssl_certificate and ssl_certificate_key. Can you please share your updated settings?

I wanted the visitors of be forwarded to already working

I’ve did exactly as you told. (app.yml shown below) and then rebuilt the image.

But visitors of get the certificate error (and can’t add exception either). I’ve even tried incognito mode.

I was wondering, in the path line (i.e. the line just next to ‘-file’), do I only need to give some name such as ‘some_name.conf’ or do I need to create that same named file ‘some_name.conf’ somewhere, under some /etc/path?

This is a great start. So, the problem I’m running into here is that since the root domains (www and non-www) do not have SSL certs assigned to them by Let’s Encrypt in the docker container build we get an HTTPS error from the browser before the redirect even happens. Right? How do we add SSL to the root domains (www and non-www) so that this redirect will actually work?

Check out Setting up Let’s Encrypt with Multiple Domains. I used this yesterday to have the site that I set up properly redirect and it worked as expected.

1 Like

Is this all still valid in 2021? I want to redirect an old url to my new host, but my discourse setup is an https:// site. It looks like the instructions here are for an http:// site (port 80?)
Would someone be so kind as to show the steps necessary to redirect: to

I’m using DO, I assume I also need to add a CNAME record in my network settings that points the old site to the new one?

Do I need to also do some things with LetsEncrypt?

Thank you for your help!

The linked topic should work. It explains how to add some stuff to the app.yml that will cause let’s encrypt to get a cert for both subdomains.k Yes, you need to use a CNAME or otherwise have both domains resolve to your droplet.

1 Like

Thank you very much for your quick reply.
So, I ONLY need to do the steps detailed in your previous post ( Setting up Let’s Encrypt with Multiple Domains ) , not the OP stuff too? (The OP refers to port 80 only)

Yes. Only the one thing in Setting up Let’s Encrypt with Multiple Domains, I’m reasonably sure.

Get the DNS right to start or you’ll hit rate limits.