hpatel migrated a site to Discourse using a custom Python script via API, successfully importing ~6k topics with new IDs, but is struggling to set up working redirects from old URLs to new Discourse topics. pfaffman explains that if the migration had used an import script, Discourse would have auto-generated import_id custom fields, which can be paired with Permalink and SiteSetting.permalink_normalizations to create redirects programmatically in Rails. Since hpatel didn’t use an import script, those fields are missing — making redirects significantly harder. pfaffman suggests manually creating permalinks using topic IDs and configuring normalization rules, and recommends reviewing existing import scripts for examples. hpatel confirms they have the new topic IDs and old URLs but need guidance on how to connect them correctly to activate redirects — indicating the missing import_id custom field is likely the root issue. The core challenge is bridging legacy URLs to Discourse topics without the built-in import tooling, requiring manual Rails scripting or alternative redirect mechanisms.
I recently managed to migrate my site from an old custom platform to Discourse successfully. However, I’m now facing the challenge of importing permalinks/redirects to the new Discourse topics. I have the IDs of all posts created in Discourse and I’m exploring options to import these redirects via API or command lines, as manually importing them due to the large amount is not feasible.
Could anyone please advise if there are any methods or tools available to efficiently import redirect links to the new Discourse topics? Your insights and suggestions would be greatly appreciated.
If your migration was based on an import script then topics (and probably posts) include an import_id custom field. You can then use those custom fields, Permalinks, and SiteSetting.permalink_normalizations to make redirects.
Thank you, Jay, for your response. Instead of using the import script for migration, I opted for API integration due to the custom structure. I developed a Python script to import posts using the API, and I have successfully fetched new topic IDs for each topic. Despite importing old URLs with new topic IDs/URLs across approximately 6k pages, none of the mappings are functioning as expected. Could you please advise on what I might be missing and how to rectify this issue? Your guidance would be greatly appreciated.