PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Weiterleitung der alten Suchmaschinenlinks nach Import von phpbb


JackFrost
08.10.2006, 10:47
Hallo ,

nach erfolgreichem Import meines phpBB2 Boardes konnte ich die Links bei Google und Co nicht mehr nutzen da sich die IDs ja verschoben haben.

Für alle die das selbe Problem haben, gibts hier eine Lösung.

Vorraussetzung für das geschriebene php-Script ist , das die TOPICS und POSTS Tabellen des phpBB2 noch vorhanden sind und in der selben Datenbank wie die vBulletin Tabellen sind.



<?php
$praefixphpbb="";
$praefixvb="";
$dbhost = "localhost";
$dbuser = "";
$dbpassword = "";
$dbname = "";
$forumurl ="http://";

$parametert=$_REQUEST['p'];

if($parametert > 0)
{

$db = mysql_connect ($dbhost, $dbuser, $dbpassword);

if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}

mysql_select_db($dbname);


$suche = intval($_GET['p']);
$table = $praefixphpbb;
$table .= 'posts';

$result = mysql_query("SELECT * FROM $table WHERE `post_id` = '$suche'") or die(mysql_error());

while($row = mysql_fetch_array($result)){
$suche = $row['topic_id'];
}
$table = $praefixphpbb;
$table .= 'topics';

$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());


while($row = mysql_fetch_array($result)){

$suche = $row['topic_title'];
}
$table = $praefixvb;
$table .= 'thread';

$result = mysql_query("SELECT * FROM $table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);

if($count > 0){

while($row = mysql_fetch_array($result)){

$thread = $row['threadid'];


}

header("location:$forumurl/showthread.php?t=".$thread);

}else{


header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);

}



$parametert=$_REQUEST['t'];

if($parametert > 0)
{

$db = mysql_connect ("localhost", "jackfrost", "freexworld");

if (!$db) {
die('keine Verbindung möglich: ' . mysql_error());
}

mysql_select_db("jackfrost");


$suche = intval($_GET['t']);

$table = $praefixphpbb;
$table .= 'topics';


$result = mysql_query("SELECT * FROM $table WHERE `topic_id` = '$suche'") or die(mysql_error());


while($row = mysql_fetch_array($result)){

$suche = $row['topic_title'];
echo $suche;
}

$table = $praefixvb;
$table .= 'thread';

$result = mysql_query("SELECT * FROM table WHERE `title` = '$suche'") or die(mysql_error());
$count=mysql_num_rows($result);

if($count > 0){

while($row = mysql_fetch_array($result)){

$thread = $row['threadid'];


}

header("location:$forumurl/showthread.php?t=".$thread);

}else{


header("HTTP/1.0 404 Not Found");
header("location:$forumurl");
}
mysql_close ($db);

}


?>

Ich habe die Weiterleitung zu dieses Script per .htaccess gemacht da ich das phpBB2 für Joomla genutzt habe.
Bei dem "orginal" phpBB2 sollte es reichen das man das Script viewtopics.php nennt.

Gruss JackFrost

StGaensler
09.10.2006, 20:08
Ohne deine Lösung jetzt schlecht machen zu wollen, aber das geht auch ohne die phpBB-Tabellen: http://www.vbulletin-germany.com/forum/showthread.php?t=25181

Viele Grüße,
Stefan

JackFrost
09.10.2006, 21:05
Thx für den link.

Naja wenigstens habe ich etwas über php gelernt :)

Gruss JackFrost