Best practices for URL forwarding/rewriting from a previous (non-Discourse) system

In the meantime a search page has been implemented:

I use this method to redirect from MyBB to Discourse, via a banner in the showthread template:

<div style="background: yellow; padding: 3em; color: red; font-weight: bold">
 This thread was migrated to
     <a href="{$thread['subject']}">the new forum</a>.
 Please <a href="">transfer your username</a>
     (if you haven't done so already) then reply there.

This is a very clever idea. To create such a mapping between post IDs, you only need to add one line of Ruby code to the MyBB importer.

You now have two options:

  1. Use a web server, e.g. nginx, to do the redirects. Then you need to format the output into something ngix will understand:

    map $uri $uri_new {
    /...?post=8 /t/54/1;  # old post_id -> /t/topic_id/post_num
    /...?post=157 /t/73/10;
    # do the maping -
    rewrite ^ $uri_new permanent;

    This is what I’ve done for my MyBB forum.

  2. Keep the old forum (or a portion of it) running. It will supply the thread/post ID as a (PHP) variable, so you’ll be able to redirect even threads that don’t have an ID in their URL. What you minimalistically need to keep running is a mapping between the thread title and the thread id, so you can map from that to the Discourse topic_id and post_num.

See also the redirecting howto. Post #21 is my nginx map method.