Change the domain name or rename my Discourse?

You may eventually want to change the domain name of your Discourse instance, from say


Let’s get started.

Set the TTL for your DNS low, and in advance

You need to let everyone know that the domain is about to change, so change the TTL for your domain name to something low, like 60 minutes.

Do this days in advance so the change can propagate throughout the Internet, and the domain name change will take effect quickly.

Remove old domain name from any site settings

Visit /admin/site_settings and query for any settings that contain the old site name.

If you get any hits on the old domain name, make sure you change those values.

Edit Discourse site name in app.yml

:mega: Alternatively, you can run ./discourse-setup again and input the new domain information instead of editing app.yml.

Edit the hostname line in app.yml

## The domain name this Discourse instance will respond to

(Also, if you are using a CDN, turn it off now by commenting out that line in the app.yml. You can turn it back on later.)

After the change, rebuild:

./launcher rebuild app

Once you do this, your site will only respond to the new domain name.

Change Your DNS

  • turn off the old domain name

  • point your new domain name to the IP of your Discourse.

Everything should come up OK, provided the site name was changed and the instance rebuilt properly in the previous steps.

Verify that the site is up and functioning, but to do that you probably need to log in, right? Which brings us to…

Fix social logins

:exclamation: Depending on how you logged in, you may need to do this first or you won’t be able to log in once the name is changed.

Your Twitter, Facebook, Google, Yahoo, GitHub social logins will all need to be edited to reflect the new domain name too. Refer to the respective guides in the howto category here.

Replace all instances of the old name with the new name in posts

All the existing posts will still refer to the old domain. Let’s fix that:

./launcher enter app


discourse remap =BEFORE= =AFTER=

answer its paranoia prompt, and finally

rake posts:rebake

This remaps text in posts from the old URL to the new URL, then regenerates all posts just in case.

And now you’re done!

(but don’t forget to turn the CDN back on after this, if you had one.)

Changing the subdomain
Move your Discourse Instance to a Different Server
Changed Domains- Not getting redirects
Great How To Guides
Having an issue after changing domain
Put forum under sub-domain and have website
To move site to a different domain name
Unable to change email address after switching domains
Our domain name changed, where do I edit the hostname?
Links broken after move
Domain change and hyperlinks
How can I bulk remap/update user email addresses?
How can I bulk remap/update user email addresses?
WP Discourse - Relinking Comments After Moving Blog
Rebake fails when changing the subdomain name only
Rename existing discourse site
I have a few questions before migrate from Xenforo 2.x to Discourse
Changing site URL
Preview links help
Preparing test Installation -some questions
Re-Run Setup Discourse
How to change the domain for Discourse?
Links broken after move
How to change URL associated with Activate Account button
Importing from phpBB3
Missing avatars and site images after import of a backup
Discourse Install on Lightsail
Can not save Default Watched Category/Tags
Changing domain from command line
All users profile pictures disappeared after data restore
Avatars lost after restore. How to get them back?
How to change URL associated with Activate Account button
Avatars lost after restore. How to get them back?
Moving from Vultr to DigtitalOcean
Migrating from SMF to Discourse
After SSL installation pictures are not displayed
Bootstrap failed after rebuild - changed domain name
Authentication and changing domain
Nil usage errors in un-self-deleting posts
Effect of changing the WordPress site URL
Moving to subdomain
Changing discourse from domain to subdomain?
Restore backup without reconfiguring Discourse
Switching forum from subdomain to sub directory
Redirect discourse URL
How to change domain but without lost ranking
Creating a duplicate of production environment
Changed Forum Address. Activation Still Links to Old Address
Rename custom domain of hosted Discourse forum
Discourse none admin side not working returning error 500
Broken image URL paths after changing hostname .. how to configure / rebake / ssh?
File URLs broken after moving to a different domain
Image links point to Incorrect (Previous) subdomain After Migration

Hi @codinghorror, Thanks! I’m going to move to (to complement our open source at ShakaCode · GitHub).

  1. Any tips on how to maintain good SEO that was going to the old domain name?
  2. Can I keep the old blog and the new blog linked to the same forum, @eviltrout? I could also move all the old blog content over to the new domain, and keep the only articles there, changing the "rel=“canonical” to the new domain. had to switch, as we’re probably going to open an offices Oahu, Kauai, and Bali eventually, and we do way more than Rails. We’re excited about the new name! And it’s a big WE now, with team members in Russia, Cambodia, Brazil, San Francisco, Toronto, Minneapolis, and, of course, Maui.

1 Like

Google’s pretty good about following redirects. Just set up a redirect (in addition to everything here) and you should be good.

1 Like

@codinghorror Jeff, do you mean being able to login with social accounts? I don’t have that setup … I guess that’s now on my todo list.

Yikes, should this be more towards the top, or bolded?

More explicitly, I think that would include the initial DNS steps you sent via email.

Some DNS changes are needed at your domain

  1. Set the A record of forum to 104.XXX.XXX.XXX (your server address):

  2. To enable mail delivery DKIM, create a TXT record for mandrill._domainkey with the following value:

     v=DKIM1; k=rsa; p=MIGfMA0...LONG_KEY_HERE..;
  3. To enable mail delivery SPF, create a TXT record for with the following value:

     v=spf1 ?all
1 Like

Do you have a pro tips for people using https with Let’s Encrypt ?
I’m actually following this howto to change my domain name and I now have to remove my old certificat to add a new one.


Do we have to change mailgun configuration (or mail server equivalent configuration)? Or can we stay with old configuration (with old domain)?

1 Like

Mailgun will be OK if you keep sending from the old domain name. You might need to tweak this (near the end of app.yml when you make the change:

  #- exec: rails r "SiteSetting.notification_email=''"


I have a question, I changed the CDN service provider, url to, but now all post image is canot display.

You’ll need to remap all your old baked posts to refer to the new CDN provider. There are existing topics on how to do this.

I have use rake posts:rebake

but now all images not use CDN url, just use my forum URL.

how can I fix this.

// update: OK, now I have launcher rebuild app, fix this.

1 Like

Both & are point to same IP address.

Followed the instruction to change from to And no error after./launcher rebuild app

But looks like nothing changed. I can only access to the old domain name

Is there anything else I can do?

It is incorrect for two different domain names to resolve to the same content, this will lead to huge duplicate content penalties in Google.

However you can redirect one domain name to the other. That is a completely different topic and is off-topic in this one.

1 Like

9 posts were split to a new topic: Do I need to rebuild when my domain name changes?

I wanted to know what is the procedure for dual container install with separate container for Data and Web.

My installation is on dual container.

Edit the web container’s .yml for DISCOURSE_HOSTNAME and rebuild that container. Everything else is the same.


8 posts were split to a new topic: Issues with base_url after renaming forum

I want to change my subdomain for my Discourse installation like to

I changed hostname in app.yml. After change, rebuild app. Now, Discourse is live again but nothing is changed. Discourse still works on domain.

Where can the problem be?

I notice @bekircem asked a question that has not seen an answer, and as a basic user, I will be facing the same challenges he faced. Do we have a solution? I want to change subdomains on the same domain.

It’s unclear whether there is (or was) a bug or if he did something wrong. @bekircem, did you did your problem? Do you have a standard install or do you have something upstream that’s doing a reverse proxy that needs to be changed?

I am yet to start my switch, so I was reading on what’s closest to mine, and I found this one that wasn’t addressed. The tutorial at the beginning of this thread is for advanced users. Makes so many assumptions.

1 Like