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

**URL:** https://meta.discourse.org/t/best-practices-for-url-forwarding-rewriting-from-a-previous-non-discourse-system/21657
**Category:** Self-hosting
**Tags:** hosting
**Created:** [29 באוקטובר,‏ 2014,‏ 10:30pm UTC](https://meta.discourse.org/t/best-practices-for-url-forwarding-rewriting-from-a-previous-non-discourse-system/21657 "2014-10-29T22:30:13Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![dandv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dandv/32/169779_2.png) [@dandv](https://meta.discourse.org/u/dandv)
#### Post date: [8 באוקטובר,‏ 2015,‏ 3:07am UTC](https://meta.discourse.org/t/best-practices-for-url-forwarding-rewriting-from-a-previous-non-discourse-system/21657/5 "2015-10-08T03:07:06Z")

</div>

> [@kayone](#):
>
> It seems like there is no dedicated search page

In the meantime a search page has been implemented:

[https://meta.discourse.org/search?q=thread+title](https://meta.discourse.org/search?q=thread+title)

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

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

```

> [@kayone](#):
>
> another option that might take some effort but would prevent almost any broken links is to create a mapping db during migration. the db would map from vanilla thread ID to the new discourse thread ID.

This is a very clever idea. To create such a mapping between post IDs, you only need to add [one line](https://github.com/dandv/discourse-post-process#fixing-quotes) 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:

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](https://meta.discourse.org/t/redirecting-old-forum-urls-to-new-discourse-urls/20930/21) is my nginx map method.

> [@Redirect old forum URLs to new Discourse URLs using permalinks](https://meta.discourse.org/t/redirecting-old-forum-urls-to-new-discourse-urls/20930):
>
> Redirecting Old Forum URLs to New Discourse URLs using permalinks If you’ve moved from other forum software to Discourse using [one of our import scripts](https://github.com/discourse/discourse/tree/main/script/import_scripts), then you probably want all your hard-earned Google search results to continue pointing to the same content. Discourse has a built-in way to handle this for you as an alternative to writing nginx rules, using the permalinks lookup table. The permalinks table allows you to set two things: a url to match, and what that url should show. There a…

---

_[View the full topic](https://meta.discourse.org/t/best-practices-for-url-forwarding-rewriting-from-a-previous-non-discourse-system/21657)._
