upgrading to phpbb3 without losing pagerank

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
philipissa
Registered User
Posts: 19
Joined: Fri Dec 14, 2007 5:59 pm

upgrading to phpbb3 without losing pagerank

Post by philipissa » Fri Oct 17, 2008 9:53 pm

Hi,

I've been looking into upgrading to phpbb3 from phpbb2, but am afraid that by doing so I may lose pagerank on my existing site. Specifically, I've noticed that the URLs have changed format.
The old urls look like:

Code: Select all

http://www.mydomain.com/phpBB2/viewtopic.php?t=10
and the new urls look like:

Code: Select all

 http://www.mydomain/phpBB3/viewtopic.php?f=4&t=10973
Spefically, the new urls have the forum id added to the url (f=4). Both URLs actually seem to resolve without any problem.

Will this change affect my pagerank for my already-indexed topics in google?

Sorry if this has been answered before, I did try to search for this question but didn't have any luck.

Thanks,
Philip

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17078
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by DavidIQ » Fri Oct 17, 2008 10:42 pm

Aren't the phpBB developers nice enough that they thought about this when they created phpBB3, keeping the main pages functionally the same (for the most part) as phpBB2? :-D

Unless you changed the directory your forum is in I don't think you need to worry much.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

philipissa
Registered User
Posts: 19
Joined: Fri Dec 14, 2007 5:59 pm

Re: upgrading to phpbb3 without losing pagerank

Post by philipissa » Sat Oct 18, 2008 3:43 am

Well, I am happy that the URL didn't change too much...but isn't the addition of the "f=id" enough to still make it seem like a different page to search engines? Wouldn't the old pages get unindexed, in favor of the newer (and therefore lower rank) pages?
Philip

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17078
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by DavidIQ » Sat Oct 18, 2008 3:59 am

Someone that's a bit more familiar with how pageranks work would be better suited to answer...like maybe EXreaction.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3391
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by thecoalman » Sat Oct 18, 2008 4:22 am

Your old URL's will still work: http://www.phpbb.com/community/viewtopic.php?t=1247355

The only issue with SE's and PR is that you no longer have any internal links pointing to them and the new URL's are duplicates. I don't have the code you need to change but you can remove the f=4 part if you wanted too. AFAIK its only used for the online listing at the bottom of individual forums.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

blakebowling
Registered User
Posts: 775
Joined: Sun Apr 27, 2008 4:49 am
Location: 127.0.0.1

Re: upgrading to phpbb3 without losing pagerank

Post by blakebowling » Sat Oct 18, 2008 4:29 am

thecoalman wrote:AFAIK its only used for the online listing at the bottom of individual forums.
And to show which forum name appears in the trail for a global announcement

User avatar
Derky
Development Team Member
Development Team Member
Posts: 4825
Joined: Sun Apr 10, 2005 9:58 am
Location: Netherlands
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by Derky » Sat Oct 18, 2008 7:11 am

Open: viewtopic.php

Find:

Code: Select all

// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')); 
After add:

Code: Select all

// Add forum_id in URL when missing
if (!isset($_GET['f']))
{
    if ($start)
    {
        $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start");
    }
    else
    {
        $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");
    }
    header("HTTP/1.1 301 Moved Permanently");
    header("location:$url");
} 
I think this will work properly for old phpBB2 links. The PageRank should be transferred to the new page with this. ;)

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17078
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by DavidIQ » Sat Oct 18, 2008 12:45 pm

From a reputable source regarding this topic:
PR is not very important and gets updated after a few months. Likely their PR on the forum is little anyways, especially in topics.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

philipissa
Registered User
Posts: 19
Joined: Fri Dec 14, 2007 5:59 pm

Re: upgrading to phpbb3 without losing pagerank

Post by philipissa » Sat Oct 18, 2008 2:29 pm

Thanks to everyone for (1) the hack to show the old links (2) the understanding of the impact of putting in the hack. DavidIQ - I know you mentioned that the PR is generally not very important, and I agree that the PR on its own probably isn't. But I have many pages that have been highly indexed and that (together) bring in a significant revenue stream, so I want to be very cautious about changes that might impact this. I'll see if I can message EXreaction as you suggest to get some extra info on how going to the new links might (or might not) affect me before putting in the hack. Thanks again,
Philip

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3391
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by thecoalman » Sat Oct 18, 2008 2:52 pm

I moved an entire forum to a new domain, using a 301 redirect and all the pages maintained their previous place in the results. Results may vary....
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

kulinar
Registered User
Posts: 651
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by kulinar » Sun Sep 26, 2010 12:38 pm

Derky wrote:Open: viewtopic.php
Please, allow me to make a few corrections to improve your code

Find:

Code: Select all

// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); 
After add:

Code: Select all

//SEO Add forum_id in URL when missing and correct forum_id if thread was moved
    if (!isset($_GET['f'])||$_GET['f']!=$forum_id)
    {
        if ($start&&start!=0)
        {
            $url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id&start=$start";
        }
        else
        {
            $url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id";
        }
        header("HTTP/1.1 301 Moved Permanently");
        header("location:$url");
    }
 
this code will not only redirect old pages (without f parameter) but also will redirect topics that are moved from one forum to another (when f parameter is changed). Also if start parameter is equal to 0, it will be skipped.

User avatar
Derky
Development Team Member
Development Team Member
Posts: 4825
Joined: Sun Apr 10, 2005 9:58 am
Location: Netherlands
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by Derky » Sun Sep 26, 2010 1:52 pm

kulinar wrote:
Derky wrote:Open: viewtopic.php
Please, allow me to make a few corrections to improve your code
That's fine, let me take a look:

Code: Select all

//SEO Add forum_id in URL when missing and correct forum_id if thread was moved
if (!isset($_GET['f'])||$_GET['f']!=$forum_id) 
You should request_var() over here. Since the $forum_id is already grabbed with request_var, you could add an extra variable that is not overwritten.
Find: $forum_id = request_var('f', 0);
Replace with: $req_forum_id = $forum_id = request_var('f', 0);
Then change the check to:

Code: Select all

if ((!isset($_GET['f']) || ($forum_id != $req_forum_id)) 

Code: Select all

if ($start&&start!=0) 
If $start is 0, the if ($start) check will fail also. ;)

Code: Select all

            $url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id&start=$start";
        }
        else
        {
            $url = "{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id"; 
You need to use append_sid() like I did. If the user is a bot, phpBB will automatically strip of the &sid=.. from the URL.

And you also need to use some spacing, see the Coding Guidelines (See: Use spaces between tokens)

kulinar
Registered User
Posts: 651
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by kulinar » Sun Sep 26, 2010 3:44 pm

Thanks, I took into account all your remarks.

Open: viewtopic.php

Find:

Code: Select all

$forum_id    = request_var('f', 0); 
Replace with:

Code: Select all

$req_forum_id =    $forum_id    = request_var('f', 0); 
Find:

Code: Select all

// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); 
After add:

Code: Select all

//SEO Add forum_id in URL when missing and correct forum_id if thread was moved
    if ((!isset($_GET['f'])) || ($forum_id != $req_forum_id))
    {
        if ($start)
        {
            $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id&start=$start");
        }
        else
        {
            $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id");
        }
        header("HTTP/1.1 301 Moved Permanently");
        header("location:$url");
    } 

User avatar
Derky
Development Team Member
Development Team Member
Posts: 4825
Joined: Sun Apr 10, 2005 9:58 am
Location: Netherlands
Contact:

Re: upgrading to phpbb3 without losing pagerank

Post by Derky » Sun Sep 26, 2010 5:07 pm

kulinar wrote:

Code: Select all

            $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id&start=$start");
        }
        else
        {
            $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id");
    } 
Also, there shouldn't be a questionmark after $phpEx.

Code: Select all

        $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start");
    }
    else
    {
        $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=
So then it's almost identical to my code, except the extra check for moved topics. :-)

Locked

Return to “[3.0.x] Support Forum”