Resource icon

vBulletin [How To] Let Google Use Direct Links in vBa Links

A recent conversation with a couple of people led to an interesting question: When linking to a remote site using a package like vBa Links that uses a redirect script to count the number of times that remote site was clicked on, does any Google PR from the referring page get passed to the remote site since the link was a redirect and not a direct link? :confused:

The short answer is "No, any PR from a site using a redirect script ends up passing that PR to the link of the redirect script and not to the actual remote site."

That conversation turned out to be pretty interesting for a number of reasons but the biggest reason was that we use vBadvanced Links here at vBUsers and want to pass on PR to our community member's sites. We believe in being a good neighbor.

So how do we fix it? Before we fix it, though, let's take a look at how vBa Links actually launches the remote site.

When you click on a link to view the remote site in vBa Links the remote URL is passed into a script named "showlink.php" (eg: showlink.php?l={linkID}) which in turn increments the database for the 'views' count and then it uses the vBulletin function 'print_standard_redirect' to actually redirect to the passed in URL. It is quite an efficient method of launching remote sites and the code is nice & tidy. Google, on the other hand, hates it because any PR from the vBa Links page will get associated to the showlinks.php script link and not the remote site.

OK, again, how do we fix it?

Thanks to the fact that the vBa Links code is nice & tidy and the fact that vBulletin has a hard-coded conditional to identify Google, MSN, and Yahoo we can change how vBa Links handles linking to remote sites with just template edits. Yep, no PHP code changes needed, just some template edits.

Below are the template edits needed to have Google, MSN, and Yahoo use a direct link to remote sites in vBa Links and then an explanation of what the changes do, and some other options available to you, are also given.


Modify your "adv_links_linkbit" and "adv_links_showlink" templates...

- In adv_links_showlink look for...
Code:
<td><a href="showlink.php?$session[sessionurl]l=$link[linkid]&amp;linkurl=$link[linkurl]" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$link[linkurl_display]</a></td>
... and replace it with:
Code:
<td><a href="<if condition="$show['search_engine']">$link[linkurl]<else />showlink.php?$session[sessionurl]l=$link[linkid]&amp;linkurl=$link[linkurl]</if>" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$link[linkurl_display]</a></td>
- In adv_links_linkbit look for...
Code:
<td align="$stylevar[left]" class="vbmenu_option falseclass"><a href="showlink.php?$session[sessionurl]l=$link[linkid]" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$vbphrase[view_site]</a></td>
... and replace it with:
Code:
<td align="$stylevar[left]" class="vbmenu_option falseclass"><a href="<if condition="$show['search_engine']">$link[linkurl]<else />showlink.php?$session[sessionurl]l=$link[linkid]</if>" target="_blank"<if condition="$show['nofollow']"> rel="nofollow"</if>>$vbphrase[view_site]</a></td>
The summary of what that change will do is that Google, Yahoo, and MSN will see the direct link and everybody else (including all other spiders) will see the usual redirect method.

If you really want all spiders to be affected then change $show['search_engine'] to $show['spider'] instead. Be warned that will impact performance on your site since it will have to parse the spiders.xml file everytime on the page load so it's not recommended (and, besides, the 'big 3' are Google, Yahoo, and MSN anyway. It'd be nice if Alexa was also included but that's another conversation.).

If you're worried about "Wait, will Google not like this since their bot will see something different then a human?" then change $show['search_engine'] to !$bbuserinfo['userid'] (note the exclamation point in front) and that way all non-registered guests (including humans) will see the direct method while registered visitors will see the redirect method. That actually wouldn't be so bad since that way the 'views' count would only be counted for people who are logged in to vBulletin.

When making your changes be careful since "showlink.php" is used in several different templates and several times in each of the templates mentioned above.
Author
Kevin
Views
185
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Kevin

Back
Top