Help with 301 redirections from phpbbseo to phpbb standard

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Ideas Centre
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
Darth Pincho
Registered User
Posts: 84
Joined: Sat Jul 05, 2003 3:33 pm
Location: Caracas - Venezuela
Contact:

Help with 301 redirections from phpbbseo to phpbb standard

Post by Darth Pincho » Sun Apr 03, 2016 5:37 am

Hi. I had the phpbbseo version installed in my site for many years. Due to lack of support of phpbbseo in the new version of phpbb 3.1 and other major reasons i was forced to upgrade from 3.0.13 to 3.1.8 (latest release)

My forum is running fine 3.1.8. all users, posts, categories where migrated ok. And running perfectly with the standard urls

The real trouble is what to do with 100.000 google indexed pages now hitting a 404 error in my server. I know this is not phpbbseo support forum. But that forum is abandoned. So i need help from people who knows how phpbb works.

I need to mass redirect at leats topics and forums urls. The other urls are not a big deal right now.

Lets try topics first

google indexed is:
/foro/anything-bla-bla-t64259.html

I need to redirect to /foro/viewtopic.php?f=XXXXX&t=64259

Where:
1) in the google indexed url i dont know the forum where the post is located, as you can see the only variable in the url is the -t[topicnumber]. I supose i have to grab the incoming url, do a database query, obtain the forum id, and then redirect to: /foro/viewtopic.php?f=[valueObtainedInQuery]&t=[ValueObtainedFromIncomingUrl] . But have not a single clue on how to do this.
2) Ive tried everything suggested in their old posts (phpbbseo.com) and doesnt work. They doesnt have an uninstall guide.

I will really appreciate any help on this.

Aditional info:
Old .htaccess file was this:

Code: Select all

# DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
#####################################################
# PHPBB SEO REWRITE RULES ALL MODES
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^foro/forum\.html$ /foro/index.php [QSA,L,NC]
# FORUM ALL MODES
RewriteRule ^foro/(forum|[a-z0-9_-]*-f)([0-9]+)(-([0-9]+))?\.html$ /foro/viewforum.php?f=$2&start=$4 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^foro/(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /foro/viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
RewriteRule ^foro/([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /foro/viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]
# PHPBB FILES ALL MODES
RewriteRule ^foro/resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /foro/download/file.php?id=$2&t=$1 [QSA,L,NC]
# PROFILES ALL MODES WITH ID
RewriteRule ^foro/(member|[a-z0-9_-]*-u)([0-9]+)/?$ /foro/memberlist.php?mode=viewprofile&u=$2 [QSA,L,NC]
# USER MESSAGES ALL MODES WITH ID
RewriteRule ^foro/(member|[a-z0-9_-]*-u)([0-9]+)/(topics|posts)/?(page([0-9]+)\.html)?$ /foro/search.php?author_id=$2&sr=$3&start=$5 [QSA,L,NC]
# GROUPS ALL MODES
RewriteRule ^foro/(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /foro/memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
# POST
RewriteRule ^foro/post([0-9]+)\.html$ /foro/viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^foro/active-topics(-([0-9]+))?\.html$ /foro/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^foro/unanswered(-([0-9]+))?\.html$ /foro/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^foro/newposts(-([0-9]+))?\.html$ /foro/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# UNREAD POSTS
RewriteRule ^foro/unreadposts(-([0-9]+))?\.html$ /foro/search.php?search_id=unreadposts&start=$2 [QSA,L,NC]
# THE TEAM
RewriteRule ^foro/the-team\.html$ /foro/memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

User avatar
canonknipser
Registered User
Posts: 1960
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by canonknipser » Sun Apr 03, 2016 7:49 am

Afaik viewtopic.php does not really need the forum-id, just try it with the topic-id and don't give a forum-id:

Code: Select all

/foro/viewtopic.php?t=64259
should work
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

Darth Pincho
Registered User
Posts: 84
Joined: Sat Jul 05, 2003 3:33 pm
Location: Caracas - Venezuela
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by Darth Pincho » Sun Apr 03, 2016 1:04 pm

I already tried. Only with the topic id, and no work at all. I have something wrong in my rewiterule.

Any clue of the exact sintaxys to do it?

This approach will generate anothe issue in the future: having 2 diferrent urls in google with the same content

viewtopic.php?t1 and viewtopic.php?t1&f1 for the same content.

rxu
Extensions Development Team
Posts: 2912
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by rxu » Sun Apr 03, 2016 1:09 pm

I'd say, leave old phpBB SEO .htaccess as is but add http 301 redirect instruction, i.e. (note R=301)

Code: Select all

RewriteRule ^foro/(forum|[a-z0-9_-]*-f)([0-9]+)(-([0-9]+))?\.html$ /foro/viewforum.php?f=$2&start=$4 [QSA,L,R=301]
and so on.

User avatar
canonknipser
Registered User
Posts: 1960
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by canonknipser » Sun Apr 03, 2016 5:05 pm

Darth Pincho wrote: Any clue of the exact sintaxys to do it?...
viewtopic.php?t1 and viewtopic.php?t1&f1 for the same content.
You need an equal-sign between the variable t and the numeric value, so your example is wrong and must be viewtopic.php?t=1 or viewtopic.php?t=1&f=1

But, rxu has a much better idea - just modify your "original" .htaccess
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

Tarantino
Registered User
Posts: 730
Joined: Sat Feb 18, 2012 1:51 pm
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by Tarantino » Wed Oct 26, 2016 1:55 pm

rxu wrote:I'd say, leave old phpBB SEO .htaccess as is but add http 301 redirect instruction, i.e. (note R=301)

Code: Select all

RewriteRule ^foro/(forum|[a-z0-9_-]*-f)([0-9]+)(-([0-9]+))?\.html$ /foro/viewforum.php?f=$2&start=$4 [QSA,L,R=301]
and so on.
That was my idea too, adding a R=301 on the end of all. So I basically did this: https://www.diffchecker.com/pAWaxCWS

Is the correct modification right?

Now my other doubt is... After changing the htaccess, will the links become phpbb default again?
And how many time do I need to keep that htaccess? I'm asking this because I want to go from 3.0 to 3.1.
So after changing the htaccess I would migrate to 3.1 and keep this htaccess, but how many time so I can put the default phpbb access? Any idea?

rxu
Extensions Development Team
Posts: 2912
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by rxu » Wed Oct 26, 2016 2:42 pm

Tarantino wrote:but how many time so I can put the default phpbb access
I suppose the time needed for Google/etc to reindex the board with phpBB default URLs.
Last edited by rxu on Wed Oct 26, 2016 6:04 pm, edited 1 time in total.

Tarantino
Registered User
Posts: 730
Joined: Sat Feb 18, 2012 1:51 pm
Contact:

Re: Help with 301 redirections from phpbbseo to phpbb standard

Post by Tarantino » Wed Oct 26, 2016 5:40 pm

Thanks rxu. I suppose my edits are correct too. And I supoose that 2~3 month should be enough.

Fingercross :lol:

Locked

Return to “[3.1.x] Support Forum”