Bulk importing Redirects to New Discourse Topics

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.

You can test in rails with something like

tcfs=TopicCustomField.where(name: 'import_id')
pcfs=PostCustomField.where(name: 'import_id')

If you don’t have those, then it’s going to be Really Hard.

If you do have those, then you can do something like

tcfs.each do |tcf|
  Permalink.create(url: "imported-topic/#{tcf.value}", topic_id: tcf.topic_id)
end

And then make a PermalinkNormalization that redirects the path for topics to /imported-topic/IMPORTED_ID.

You can grep the import_scripts` to find some other import scripts that set Permalinks and the permalink normalization.