I currently use discourse as our forum and comment engine for our wordpress blog. For a number of reasons I’m considering moving the blog to a subomain - from domain.com to blog.subdomain.com
The wordpress part of this is straightforward and even the nginx rewrites to keep the SEO is clear.
I’m curious, however, if there is a smooth way to not break all our existing post connections - do I do a site-wide force publish once all the urls are straight on the wordpress side - or will that make all new topics and leave all the others as confusing multiple posts with the wrong links?
Do I go into each post and update post - or will that not overwrite the existing link to the blog post in the forum topic?
Do I have to get into largescale search and replace within the discourse database to do this reliably?
You would be able to update everything except for the TopicEmbed.embed_url values by republishing the posts from WordPress to Discourse after you change the WordPress domain name. If you take that approach, you’ll need to loop through the TopicEmbeds on your forum and update the embed_url for each one.
A faster, but possibly more dangerous approach would be to use the Discourse remap script. You can find details about using it in this topic: Change the domain name or rename my Discourse?
Running discourse remap domain.com blog.domain.com will rewrite all occurrences of domain.com in your database. Be sure to save a backup of your database before you try it.
Thank you for the reply Simon! I think I’ll try to force publish all of the wordpress posts and then do the remap - seems straightforward enough. I’ll report back with the results, just in case others plan on carrying this out in the future.
Can I run remap again but do remap /domain.com /blog.domain.com to get it to only match the root domain? or do I have to do a fancier regex there to get that?