I want to 301 a large amount of old URLs.
Can I do this via PHP in a 404 script, or would this mess up search engine results (them thinking the pages are not found)?
My current .htaccess:
ErrorDocument 404 /404/
My 404/index.php script plan:
<?
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>
So, basically, the redirecting isn't a problem, but I don't want a search engine to think these pages are "not found" or will "think less" of them, or anything like that...
Is this legit? Will Google be happy with this?