Jump to content

301 Redirects for Thread Pages in Migration From phpBB 2 to Invision


Recommended Posts

Hey folks,

Long story short, for years I've been planning a migration for a now 23 year old phpBB 2 to current gen Invision. Some of that planning has involved help from Invision folks like @Matt@Stuart Silvester, and others, for which I'm super grateful. We're actually doing it this weekend! I'm hoping we can successfully complete it. 🙂 We've been at it since Thursday, and it's looking pretty good.

I ran into something that is not a blocker and I suspect is a dead end, but I wanted to ask anyway. Thanks to Stuart, we have working rewrite rules (included at the end of the post) that will correctly forward all profiles, forums, and the first page of every thread, which is awesome. But I've realized that Google has substantially indexed subsequent pages on threads. And the redirect breaks on these, obviously.

For example, here is the current URL structure:

https://karateforums.com/where-did-martial-arts-originate-from-vt42954.html (page 1, redirect works)
https://karateforums.com/where-did-martial-arts-originate-from-vt42954-10.html (page 2, redirect broken)
https://karateforums.com/where-did-martial-arts-originate-from-vt42954-20.html (page 3, redirect broken)

Right now, these 3 links redirect to, respectively:

https://karateforums.com/where-did-martial-arts-originate-from-vt42954.html (works!)
https://karateforums.com/where-did-martial-arts-originate-from-vt42954-10.html (broken, of course)
https://karateforums.com/where-did-martial-arts-originate-from-vt42954-20.html (broken)

In Invision, the working  links are:

https://karateforums.com/where-did-martial-arts-originate-from-vt42954.html 
https://karateforums.com/topic/40797-where-did-martial-arts-originate-from/page/2/
https://karateforums.com/topic/40797-where-did-martial-arts-originate-from/page/3/

Where our old software added -10 for page 2, -20 for page 3, etc., Invision adds /page/2/ and /page/3/. Which is better. I don't *think* there is any way for us to save these indexed page links and properly 301 redirect them because I don't think there is any way that an internal redirect could recognize -10 and see it as page 2. So, I assume this is a lost cause. Which is not the end of the world. 🙂 But I figured there was no harm in asking the community.

My assumed fallback is to see if I can use a rewrite to remove the -10, -20, -30, etc. part of the URL and redirect people to the first page of a given thread. Better than a dead link. But yeah, would love to hear ideas. I appreciate your time and consideration. Thanks.

RewriteEngine On
RewriteRule ^(.*)-vf([0-9]+).html viewforum.php?f=$2 [R=301,NC,L]
RewriteRule ^(.*)-vt([0-9]+).html viewtopic.php?t=$2 [R=301,NC,L]
RewriteRule ^member([0-9]+).html memberlist.php?u=$1 [R=301,NC,L]

 

Edited by Patrick O'Keefe
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...