Changing discourse from domain to subdomain?

Hello there, and sorry I know this has been asked in the past. I’ve tried to do diligent research on the matter, and in doing so looked at several existing threads, including this one:

I guess I’m not following 100% because the situation isn’t exact or close enough to my own. In my case I installed Discourse on the main domain, thinking we would use it exclusively. So the install is at example.com and I’d like to change it to be at discourse.example.com, and then install a blog for the main domain (separate server).

The instructions mention removing the old domain name from site settings, but the domain name will in fact be a subdomain of the same domain, so I’m not sure how that would be done.

Does this mean I’ll need to edit the app.yml for the domain name, which seems pretty straightforward, and then remap, rake posts, rebake as indicated in referred post?

Thanks in advance for any additional details you may have to offer, I appreciate it.

Technically, sub.example.com is different than example.com despite being part of same domain. You can safely follow those instructions replacing example.com with discourse.example.com and it will migrate your forum to the subdomain.

Apart from rebuild the remap command should be:

discourse remap example.com discourse.example.com

5 Likes

Ah, ok, yeah that makes perfect sense actually.

Final question would be the issue with the social logins. I currently have them set to the main domain, when it says to update them I assume that means update the settings for the login app itself with the login provider (in my case FB and Twitter), is that correct

You’ll need to update your domain on all external services Including:

social login
Analytics
Uptime monitoring
Anything else

E.g. go to Facebook developers console and update the callback url and Authorized domain and same for twitter.

3 Likes

Ok thanks so much for the clarity. :blush:

1 Like

I moved my forum to a new domain but didn’t run the remap directly and now I get a conflict as there are some poste with the new and the old domain and running the remap will fail.

Error: ERROR:  duplicate key value violates unique constraint "unique_post_links"
DETAIL:  Key (topic_id, post_id, url)=(23737, 113202, https://MYDOMAIN/) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.

ist there a way to ignore this to remap at least everything else. Or can I manually remove that entry and from the database? I did something similar years ago but I can’t find how to get into pgsql.