Non intendevo questo. Il 301 sostituisce gradualmente i link e Google se lo dimentica pian pianino, ma non in modo così esplicito. Chiedevo se era possibile cancellare la pagine non trovate (404) in modo più rapido.
Visualizzazione Stampabile
Sì podarsi che lo fa. Non ero al corrente che esistesse ;)
Incollo qui perché sono quasi certo che bisogna fare un paio di modifiche per farlo funzionare:
Codice PHP:
<?php
/**
* 404 /301 for external and internal link redirect.
*
* @package ImpEx.tools
* @version $Revision: 1902 $
* @author Jerry Hutchings <jerry.hutchings@vbulletin.com>
* @modified by Oleg Ignatiuk
*/
$standard_404 = 'http://www.example.com/not_found.html'; // The usual 404 that this script replaces
$new_domain = 'example'; // Including domain extension such as www.example.com , donot include http://
$new_folder = 'vBulletin'; // Without trailing slash
$ext_type = '.php'; // File extension type that vBulletin is using, i.e. index.php including the preceding dot
// Database
// This is the vBulletin database, needed for import id look up and logging
$server = 'localhost';
$user = 'user';
$password = 'password';
$database = 'forum';
$tableprefix = '';
$old_id = intval($_GET['oldid']);
$page = intval($_GET['page']);
$postcount = intval($_GET['postcount']);
$action = $_GET['action'];
$sql = null;
switch ($action)
{
case 'forum':
$sql = "SELECT forumid FROM {$tableprefix}forum WHERE importforumid={$old_id}";
$new_url = "http://{$new_domain}/{$new_folder}forumdisplay{$ext_type}?f=";
break;
case 'thread':
$sql = "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";
$new_url = "http://{$new_domain}/{$new_folder}showthread{$ext_type}?t=";
break;
case 'post':
$sql = "SELECT postid FROM {$tableprefix}post WHERE importpostid={$old_id}";
$new_url = "http://{$new_domain}/{$new_folder}showpost{$ext_type}?p=";
break;
case 'user':
$sql = "SELECT userid FROM {$tableprefix}user WHERE importuserid={$old_id}";
$new_url = "http://{$new_domain}/{$new_folder}member{$ext_type}?u=" ;
break;
}
if( $sql )
{
$link = @mysql_connect($server, $user, $password);
if ($link)
{
$db_selected = @mysql_select_db($database, $link);
if ($db_selected)
{
$result = @mysql_query($sql);
$row = @mysql_fetch_row($result);
if (!$row[0])
{
$action = 'Original data missing';
}
@mysql_free_result($result);
}
}
}
if (!$sql || !$old_id || !$row[0])
{
?>
<html>
<head>
<meta http-equiv="refresh" content="<?php echo $refresh_speed; ?>; URL=<?php echo $standard_404; ?>">
</head>
<body>
</body>
</html>
<?php
// Got nuffink
die;
}
$new_url .= $row[0];
if($page)
$new_url .= "&page={$page}";
if($postcount)
$new_url .= "&postcount={$postcount}";
@mysql_close($link);
header( "HTTP/1.1 301 Moved Permanently" );
header( "Location: {$new_url}" );
?>
.htaccess phpBB Redirect con lo script sopra
Codice:RewriteCond %{QUERY_STRING} f=([0-9]+)
RewriteRule viewforum\.php vbseo301.php?action=forum&oldid=%1 [L]
RewriteCond %{QUERY_STRING} t=([0-9]+)
RewriteRule viewtopic\.php vbseo301.php?action=thread&oldid=%1 [L]
RewriteCond %{QUERY_STRING} ^p=([0-9]+)
RewriteRule viewtopic\.php vbseo301.php?action=post&oldid=%1 [L]
RewriteCond %{QUERY_STRING} u=([0-9]+)
RewriteRule profile\.php vbseo301.php?action=user&oldid=%1 [L]
Da quello che ho letto sul web mi sembra che questo script possa essere la soluzione giusta.
Vi farò sapere quando farò il passaggio... :)
Anche se sto un attimo temporeggiando visto che alcuni script in PHP che ho sul sito sono incompatibili con PHP5... vediamo più avanti appena finisco il rstyling del sito, ciao e grazie :)
Se puoi darmi i riferimenti di come farai, sarebbe molto generoso ;)