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.
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.
/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.
Alternatively, you can run
./discourse-setupagain and input the new domain information instead of editing
Edit the hostname line in
## The domain name this Discourse instance will respond to DISCOURSE_HOSTNAME: '=AFTER='
(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.
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…
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.
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
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?