Permalink redirection for internal topic urls

(Leo) #1

We’re establishing multiple Discourse sites internally. Sometimes we need to move topics from one site to another. In this case we need to apply redirection for moved topics. But permalinks won’t work for internal discourse topic urls.
For example permalink won’t redirect from to It will just return 404 not found when it can’t find the topic on first site.
I’ve tried creating permalinks like following:
Permalink.create(url: '/t/sample-topic/1234', external_url: '')

Any workaround to get permalink work for internal urls?

(Jeff Atwood) #2

Hmm, that seems like it should work if the sites are at different URLs. Any ideas @techapj?

(Vinoth Kannan) #3

I already faced the same. It won’t work even if it not internal multisite.

We deleting old topic and create permalink after it moved to new website. The problem is since the topics are not permanently deleted when normal users visit permalinks not even checked. And showing 404 since he can’t see it. When staffs visit we still showing old deleted topic.

Here we should check permalinks for normal users.

(Jeff Atwood) #4

Sorry I am not quite understanding that? This is about deleted topics?

(Vinoth Kannan) #5

Yes. Here obviously he will delete the topic from old site after it moved to new site.

(Arpit Jalan) #6

Hi Leo,

Can you PM me the old and new links so that I can debug this issue?

Also, as @vinothkannans mentioned above, are you able to see deleted topic when visting as Admin?

(Leo) #7

Hi Arpit

I debugged this for a while. Actually there is a route that handles permalink urls. So basically any internal topic url won’t fall into this route because there is already a route for topic#show. I endup overwriting this action topic#show to look for permalink first if exist, else find the topic.