8th January 2014, 14:08
#2
1 out of 1 members found this post helpful.
Fă o tabelă redirects pe site-ul vechi cu 3 coloade id, old_uri (URI pagină veche) şi new_uri (URI pagină nouă)
în index.php la început, introdu codul:
$connection=mysql_connect (localhost, $username, $password);
$db_selected = mysql_select_db($database, $connection);
$sql = "SELECT new_uri FROM redirects WHERE old_uri='".$_SERVER["REQUEST_URI"]."' LIMIT 1";
$result = mysql_query($sql, $connection);
if(mysql_num_rows($result)>0){
$row = mysql_fetch_row($result);
@mysql_close($connection);
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: http://www.example.com".$row[0]);
die();
}else{
@mysql_close($connection);
header("HTTP/1.1 410 Gone");
die();
}
înlocuieşti în cod "www.example.com" cu domenil nou