Change the domain name or rename my Discourse?

(Jeff Atwood) #1

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

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

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.

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.

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

Move your Discourse Instance to a Different Server
Changing the subdomain
Assets broken after moving installation to subdomain
Changed Domains- Not getting redirects
Great How To Guides
Transfer Discourse forum to another domain
Google oauth 2.0 hanging on request
Having an issue after changing domain
Put forum under sub-domain and have website
Unable to change email address after switching domains
User avatar url broken after changing domain name
Restore backup without reconfiguring Discourse
Switching forum from subdomain to sub directory
Help needed: installing discourse in a new domain with no technical background
Broken image URL paths after changing hostname
/var/discourse just vanished
Rename custom domain of hosted Discourse forum
Discourse none admin side not working returning error 500
File URLs broken after moving to a different domain
How can I bulk remap/update user email addresses?
How can I bulk remap/update user email addresses?
Creating a duplicate of production environment
Changed Forum Address. Activation Still Links to Old Address
Redirect discourse URL
How to change the domain for Discourse?
Our domain name changed, where do I edit the hostname? .. how to configure / rebake / ssh?
To move site to a different domain name
Re-Run Setup Discourse
Preparing test Installation -some questions
Preview links help
Changing site URL
How to change domain but without lost ranking
Moving to subdomain
Domain change and hyperlinks
WP Discourse - Relinking Comments After Moving Blog
Image links point to Incorrect (Previous) subdomain After Migration
Assets broken after moving installation to subdomain
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
(Justin Gordon) #16

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
Discourse and WP
(Kane York) #17

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

(Marco) #18

How do I find the string app.yml?

(cpradio) #19

You need to ssh into your server, then enter the docker container, then you should see the app.yml file.

(Paul Solt) #20

I think these steps will help in finding discourse (cd /var/discourse) after you login to your server (i.e. Digital Ocean if you did the $99 setup). Redirect single/multiple domain(s) to your Discourse instance

(Paul Solt) #21

@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
(Snickers Urbex I/O) #22

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.

(harvey) #23

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

(Jay Pfaffman) #24

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=''"
(Eric Chang) #25


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

(Matt Palmer) #26

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.

(Eric Chang) #27

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
(Felix) #28

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?

(Jeff Atwood) #29

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
(Felix) #30

I’m mean to replace with

It’s OK if no other thing I can do in Discourse, I just started to setup a new site and I can reinstall Discourse.

(Nordize) #31

I’m new to Discourse and I’ve already needed to change hostnames. It would be safer to do instead:

discourse remap // //

so that only actual urls are replaced

(Mitchell Krog) #32

I just did a domain change a week ago and followed this and it worked perfectly for me.

(Jeff Atwood) split this topic #33

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

(Hung V Pham) #34

This will update the database, right?