I finally got around to moving the new site to the primary randomfoo.net domain. Old stuff is still accessible at: legacy.randomfoo.net.
Here’s the very simple code I put in my errorhandler to prevent linkrot:
if($_SERVER['REDIRECT_STATUS'] == '404') {
require_once "HTTP.php";
$url = 'http://legacy.randomfoo.net' . $_SERVER['REQUEST_URI'];
$result = HTTP::head($url);
if($result['response_code'] == 200) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: $url");
header("Connection: close");
}
}
Notice any problems? Let me know.