bonsoir a tous,
pour faire une redirection hors votre forum.
Ajouter ce code dans votre .htaccess
- Code: Tout sélectionner
ErrorDocument 404 /Erreur_404.php
puis crée un fichier avec le nom Erreur_404.php et met ce code php
- Code: Tout sélectionner
<?php
$nouvelleAdresse='http://votre site.com/page.html'; //Nouvelle adresse
if (isset($_SERVER['QUERY_STRING'])&&($_SERVER['QUERY_STRING']!=''))
$nouvelleAdresse.='?'.substr($_SERVER['QUERY_STRING'],0,2048); //Récupère les paramètres
header('Location: '.$nouvelleAdresse); //Redirection HTTP
header('HTTP/1.1 301 Moved Permanently');
header('Status: 301 Moved Permanently');
header('Content-Type: text/html; charset=UTF-8');
$nouvelleAdresse=htmlspecialchars($nouvelleAdresse,ENT_QUOTES); //Encode les caractères HTML spéciaux
echo '<'.'?xml version="1.0" encoding="UTF-8"?'.'>'."\n", //Entête XML
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n",
'<html xmlns="http://www.w3.org/1999/xhtml">'."\n",
'<head>'."\n",
'<meta http-equiv="content-type" content="text/html; charset=UTF-8" />'."\n",
'<meta http-equiv="refresh" content="0; url='.$nouvelleAdresse.'" />'."\n", //Redirection HTML
'<title>Redirection</title>'."\n",
'<meta name="robots" content="noindex,follow" />'."\n",
'</head>'."\n",
"\n",
'<body>'."\n",
'<p><a href="'.$nouvelleAdresse.'">Redirection</a></p>'."\n",
'</body>'."\n",
'</html>'."\n";
?>
n'oublie pas de changer -http://votre site.com/page.html