# Help with permalinks after forum migration

**URL:** https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616
**Category:** Migration
**Created:** [January 12, 2022, 9:01am UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616 "2022-01-12T09:01:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [January 12, 2022, 9:01am UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/1 "2022-01-12T09:01:53Z")

</div>

Hi, after the conversion from phpBB Google indexing has collapsed and even after months has never recovered.  
I believe the problem is due to the many 404 mistakes due to the permalinks not working.  
They are the predefined ones generated by the conversion script.

![Crawl](https://global.discourse-cdn.com/meta/original/3X/6/7/67ddf8668e74a0c6463c0873af6533075fd2061b.png)

![Permalinks](https://global.discourse-cdn.com/meta/original/3X/4/e/4e9cf4b02ac3a0f6adb220f7abfb077e51077b9c.png)

How can I correct them?  
For example [https://www.mysite.com/viewtopic.php?t=1267](https://www.mysite.com/viewtopic.php?t=1267) It’s not redirected.

Thanks

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 12, 2022, 4:29pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/2 "2022-01-12T16:29:20Z")

</div>

Do the permalinks exist if you look at `/admin/customize/permalinks`?

What do they look like?

If not, you’ll need to get a script to generate them.

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [January 12, 2022, 6:39pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/3 "2022-01-12T18:39:36Z")

</div>

Thanks for your help @pfaffman, yes I have what you see in the previous image.

For the categories I used this and it works perfectly

```plaintext

/(viewforum.php\?)(?:.*&)?(f=\d+).*/\1\2

```

The ones I found after conversion are these but only works for the categories.

> <https://github.com/discourse/discourse/blob/main/script/import_scripts/phpbb3/importers/permalink_importer.rb#L3-L4>

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 12, 2022, 6:41pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/4 "2022-01-12T18:41:18Z")

</div>

No. Not the permalink site settings. The permalinks at the URL in the my last message.

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [January 12, 2022, 6:48pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/5 "2022-01-12T18:48:29Z")

</div>

There are permalinks for the categories and now I understand what you mean.

During conversion the permalinks for discussions were not created.

Ok, there are more than 2500 discussions … for now I give up …

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 12, 2022, 6:51pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/6 "2022-01-12T18:51:12Z")

</div>

You can see that the mapping from the old to the new is available with

```plaintext
./launcher enter app
rails c
TopicCustomField.all

```

So then you would run a script that for each of those values a permalink gets created. It’s hard to explain, but it’s possible.

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [January 12, 2022, 7:11pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/7 "2022-01-12T19:11:10Z")

</div>

You’re right there are all the data of the old phpBB discussions.  
Thanks anyway of the help, unfortunately I don’t know how to use them.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 12, 2022, 7:26pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/8 "2022-01-12T19:26:41Z")

</div>

This is an example from another importer. You might be able to adjust it to create the permalinks on your server.

> <https://github.com/discourse/discourse/blob/main/script/import_scripts/answerhub.rb#L474-L487>

You’d change the `Permalink.create` line to match the links from phpBB

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 14, 2022, 6:53pm UTC](https://meta.discourse.org/t/help-with-permalinks-after-forum-migration/214616/9 "2022-01-14T18:53:28Z")

</div>

It is _critical_ to get redirects in place for old content as part of a migration! I hope you can get this resolved, but maybe we need to update our documentation on migration @tshenry @dax to make this point?
