Change the domain name or rename my Discourse?

:warning: This guide is for self-hosted Discourse instances that were installed using our installation guide on GitHub. If you are hosted by Discourse, please see Configure your domain name for hosted Discourse for specific instructions.

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.)

wondering how we created that form?

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
Links broken after move
Moving to subdomain
Our domain name changed, where do I edit the hostname?
Unable to change domain name
Unable to change email address after switching domains
Redirect discourse URL
WP Discourse - Relinking Comments After Moving Blog
Can I change the domain name - without a clean install?
Links broken after move
Moving from Vultr to DigtitalOcean
Importing / migrating from phpBB3
Missing avatars and site images after import of a backup
Discourse Install on Lightsail
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?
How might we better structure #howto?
Problem accessing plugin admin after restore
Migrate from AWS to Digital Ocean with 2 containers, spaces and 2 CDNs
Problem linking Discourse forum to WP Discourse
Site responds 502 Bad gateway - is it Ruby?
All internal links broken after restoring backup to new server
How to change URL associated with Activate Account button
Administrative Bulk Operations
Questions about rebake
Cloned my DO discourse droplet, how to get clone to go to right domain?
Too many user emails domains not working lead to mailgun domain disabled: what to do?
I got links. Where do they come from?
Problem linking Discourse forum to WP Discourse
Help changing domain
Onebox error code of 403
如何修改 Discourse 的域名
Can not save Default Watched Category/Tags
Using external Domain in the browser address line
After activating HTTPS Discourse doesn´t work
504 Gateway error after launching new AWS instance
Image uploads used to work but no longer do after forum name change?
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
Changing discourse from domain to subdomain?
Restore backup without reconfiguring Discourse
Switching forum from subdomain to sub directory
Creating a duplicate of production environment
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
How can I bulk remap/update user email addresses?
How can I bulk remap/update user email addresses?
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
Moving from one S3 bucket to another
Preparing test Installation -some questions
Re-Run Setup Discourse
How to change the domain for Discourse?

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 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

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.


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?

Does it work on

To make it stop loading on, you should remove the DNS settings that point it to the Discourse server.

1 Like

Ah! I bet that he’s not using https (because then there would be another problem). If https was on it’d redirect to the new domain.

1 Like

You may wish to point your old name at a remapping server that returns a 301 HTTP redirect to your new server.


What is a TTL and a CDN and where/what is app.yml

1 Like

TTL is the Time To Live of the registry of the DNS, the one that says where really is.

CDN is Content Delivery Network, and if you haven’t heard it before, you probably won’t have one and don’t need to worry about it.

app.yml is the configuration file that tells Discourse some basic stuff about your site, it’s in /var/discourse/containers if I remember correctly.


If you’re a hosted customer then you don’t care where app.yml is, as you don’t have access to it.