URL redirects no longer always work the first time


(Leo Davidson) #1

Our forum was converted from phpBB, with the importer creating a big table of URL redirects to keep all the old links working, which was much appreciated.

For example:

  • https://resource.dopus.com/viewtopic.php?t=4791

Redirects to:

  • https://resource.dopus.com/t/how-to-exit-directory-opus/3479

That worked well for about a year but in the last few months or so we’ve noticed that the first time you click on a redirect URL, you sometimes get Discourse’s “oops! that page doesn’t exist” error page.

The weird thing is, the redirects are not missing or broken, they actually do work, if you click the browser’s Refresh button when on that error page. Once you’ve done that once, the redirect URL then works fine (at least on the same computer).

I couldn’t find any other threads about this so I wonder if it’s something that has gone wrong with our forum, or maybe a plugin we’re using. Or is this a known issue? Any idea how to debug it, or what might be causing it?


Aside:

Those redirects are still important to us, even now, since we have some external links and also quite a few posts on the forum still use the old URLs to link to each other. (At least at the time, the importer converted links in posts to the new format, but only if a later post linked to an earlier post; some posts had links to posts newer them themselves via edits, which remained in the old URL format, since the importer could only create redirects to topics that had already been converted when converting each topic. Our FAQs section in particular has a lot of crosslinking.)


(Jeff Atwood) #2

This worked fine for me in mobile safari, first time.


(Leo Davidson) #3

I’m not sure if external redirects fail, or only ones when you’re already in a post and the site links to itself. (Maybe the JavaScript side gets confused?)

Or it’s also possible that once someone does a browser refresh on the error page it fixes the redirect for everyone. Hard to tell.

Seems odd that the behaviour of a URL can change just from a refresh, but I figure the JavaScript app intercepts and handles clicks within the site quite differently to the browser expliciltly requesting a page/URL, so maybe the problem is there somewhere.

Next time it happens I’ll experiment with other computers/browsers.

Sounds like it isn’t a known issue, at least. I’ll post back if I find anything that might be useful.


(Jeff Atwood) #4

Internal links will be a nightmare because you have copied the domain exactly in your migration from old to new forum. We do not recommend that.


(Jay Pfaffman) #5

Permalinks don’t work internally. The URLs need to be rewritten with the discourse URLs.


(Leo Davidson) #6

I could swear they used to. Maybe we just never noticed it until more recently.

In that case the problem with the phpBB importer where it cannot rewrite URLs to newer posts than the one it is currently converting is a bug rather than just a minor annoyance. Assuming that is still the same. (I have not done another phpBB import since the original one so maybe it’s already fixed.)

I’ll do a search on my forum and edit anything which still links to the old style URLs. Case closed!


(Jay Pfaffman) #7

I’ve not looked at the code, but I think that several that do those rewrites assume that people won’t link to the future. But if you have long lasting topics then that could happen a lot.

It’s probably possible to run code to do those replacements now from the console


(system) #8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.