大量の古い URL を 301 したい。
404 スクリプトで PHP を介してこれを行うことはできますか、それとも検索エンジンの結果を台無しにしますか (ページが見つからないと考えているため)。
私の現在の.htaccess:
ErrorDocument 404 /404/
私の 404/index.php スクリプト計画:
<?
switch (rtrim($_SERVER["REQUEST_URI"],"/")) {
case "/blah/foo" :
$redirect="/somewhere_else/";
break;
case "/over_here" :
$redirect="/over_there/";
break;
case "/etc/etc/etc" :
$redirect="/etc/and_so_on/";
break;
}
if($redirect) {
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".$redirect);
exit();
}
?>
<html>
<head>
<title>404: Page not found.</title>
</head>
<body>
<h1>404: Page not found.</h1>
</body>
</html>
したがって、基本的にリダイレクトは問題ではありませんが、検索エンジンにこれらのページが「見つからない」または「あまり考えない」などと思わせたくありません...
これは合法ですか?グーグルはこれに満足するだろうか?