Change the domain name or rename your 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

From the root directory where you installed Discourse you can run the follow to edit your app.yml file

cd /var/discourse
nano containers/app.yml

Then find and edit:

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

(If you don’t have discourse binary, you can use the rake version: bundle exec rake posts: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?

Last Reviewed by @SaraDev on 2022-05-24T21:00:00Z