| :: |
| Author |
Message |
zinnerz PR0

Joined: 08 Jun 2006 Posts: 75
|
Posted: Mon Jan 15, 2007 12:48 am Post subject: external link rel="nofollow" |
|
|
Dear Dcz,
I've search and read on this thread:
phpbb-forum/discussions-vt411.html
but I didnt find a mod about rel nofollow to external link
Still waiting on this one.. |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14854
|
|
| Back to top |
|
 |
philippe phpBB SEO Team


Joined: 23 Jun 2006 Posts: 508 Location: Région Parisienne
|
|
| Back to top |
|
 |
zinnerz PR0

Joined: 08 Jun 2006 Posts: 75
|
Posted: Mon Jan 15, 2007 11:14 pm Post subject: Re: external link rel="nofollow" |
|
|
thanks Dcz and Philippe
I found redirector script from Own Redirector and Anonymization v2.0 for vBB:
hack instruction:
| Code: |
1. Upload "links.php" to your Forum Rootfolder.
2. Open includes/class_bbcode.php
Search for :
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>"; |
| Code: | Replace with :
$url_info = parse_url($rightlink);
if ($url_info["host"]=="www.YOURDOMAIN.de"):
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
else:
return "<a href=\"http://www.YOURDOMAIN.de/forum/links.php?url=$rightlink\" target=\"_blank\">$text</a>";
endif; |
links.php script:
| Code: | <?
foreach ($_GET as $key => $value) {
$site .= $key."=".$value."&";
}
$site = substr($site, 4, -1);
?>
<HTML>
<HEAD>
<TITLE>Re-directing...</TITLE>
<meta http-equiv="refresh" content="5; URL=<? echo $site; ?>">
</HEAD>
<body>
<br>
<div style="text-align: center;">
<center><font
style="color: rgb(204, 0, 0); font-weight: bold;" size="-1"><span
style="font-family: Arial;">Du hast gerade einen
externen Link angeklickt, welcher mit einem fremden Web-Projekt
verknüpft ist.
<br>
<br>
Der Verantwortungsbereich von DEINEDOMAIN.de erstreckt sich nicht auf den
sich jederzeit wandelnden könnenden Inhalt fremder Web-Sites.<br>
<br>
Daher übernehmen wir keinerlei Verantwortung
für die nachfolgenden Informationen und machen uns diese nicht
zu Eigen.
<br>
<br>
Du wirst weitergeleitet zu :</span></font><br>
<b><i>
<i> <? echo $site; ?></i></b></center>
</body>
</HTML> |
Hi Dcz, how about converting this code so it will working on phpBB  |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14854
|
|
| Back to top |
|
 |
zinnerz PR0

Joined: 08 Jun 2006 Posts: 75
|
Posted: Fri Jan 19, 2007 6:16 am Post subject: Re: external link rel="nofollow" |
|
|
Finally, I've added rel="nofollow" on bbcode.php and bbcode.tpl
bbcode.php
| Code: | $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\" rel=\"nofollow\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\" rel=\"nofollow\">\\2</a>", $ret);
and
$text = preg_replace("#<!-- BBCode auto-link start --><a href=\"(.*?)\" target=\"_blank\" rel=\"nofollow\">.*?</a><!-- BBCode auto-link end -->#i", "\\1", $text); |
bbcode.tpl
| Code: | | <!-- BEGIN url --><a href="{URL}" target="_blank" class="postlink" rel="nofollow">{DESCRIPTION}</a><!-- END url --> |
it's working..  |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14854
|
|
| Back to top |
|
 |
zinnerz PR0

Joined: 08 Jun 2006 Posts: 75
|
Posted: Fri Jan 19, 2007 5:09 pm Post subject: Re: external link rel="nofollow" |
|
|
Hehehe, dont have any choice..
Btw I will wait for you to release redirect php  |
|
|
| Back to top |
|
 |
HB phpBB SEO Team

Joined: 16 Oct 2006 Posts: 809
|
Posted: Wed Feb 14, 2007 2:18 am Post subject: Re: external link rel="nofollow" |
|
|
| dcz wrote: | yes, but this is for all links
Even the internals.
++ |
Or combine drathbun's Local Links mod and the rel="nofollow" modification to the bbcode.tpl for nofollow's on all external links. That is:
| Code: | while ($start_url)
{
// First identify the end of the URL by finding the >
$last_found_pos = $start_url + 1;
$end_url = strpos ($text, '>', $last_found_pos);
$url_len = $end_url - $start_url + 1;
// Next get a copy of the URL from <a href="... to closing >
$my_url = substr($text, $start_url, $url_len);
// replace target wtih null string
$my_local_url = str_replace('target="_blank"', '', $my_url);
// Replace old URL with new URL in post text. Note that while
// the comparison was done in lower case via the strtolower()
// function, the actual URL text is not changed in any way.
// Only the target.
$text = str_replace($my_url, $my_local_url, $text);
// Advance by length of URL minus length of "target" string
// and check for another local URL in the same post text.
$start_url = strpos(strtolower($text), $local_url, $last_found_pos + $url_len - 16);
} |
Becomes:
| Code: | while ($start_url)
{
// First identify the end of the URL by finding the >
$last_found_pos = $start_url + 1;
$end_url = strpos ($text, '>', $last_found_pos);
$url_len = $end_url - $start_url + 1;
// Next get a copy of the URL from <a href="... to closing >
$my_url = substr($text, $start_url, $url_len);
// replace target wtih null string
$my_local_url = str_replace('target="_blank" rel="nofollow"', '', $my_url); // changed
// Replace old URL with new URL in post text. Note that while
// the comparison was done in lower case via the strtolower()
// function, the actual URL text is not changed in any way.
// Only the target.
$text = str_replace($my_url, $my_local_url, $text);
// Advance by length of URL minus length of "target" string
// and check for another local URL in the same post text.
$start_url = strpos(strtolower($text), $local_url, $last_found_pos + $url_len - 30); // changed
} |
Of course this assumes that you like the local links mod. |
_________________ Dan Kehn |
|
| Back to top |
|
 |
zinnerz PR0

Joined: 08 Jun 2006 Posts: 75
|
Posted: Wed Feb 14, 2007 4:39 am Post subject: Re: external link rel="nofollow" |
|
|
Thank HB, I've been using Deter Comment Spam.
It will add rel="nofollow" to all external links. |
|
|
| Back to top |
|
 |
|
|