Skip to content

Instantly share code, notes, and snippets.

@kevinpet
Created April 19, 2009 07:28
Show Gist options
  • Save kevinpet/97962 to your computer and use it in GitHub Desktop.
Save kevinpet/97962 to your computer and use it in GitHub Desktop.
<?php
# Nucleus legacy incoming links redirect script
# see blog post at http://kdpeterson.net/blog/ for explanation
$items = array(
"27" => "2007/05/1846-the-murder-of-jose-de-los-reyes-berreyesa-and-the-twin-brothers-named-haro-by-a-group-of-bear-f.html",
"43" => "2008/03/the-widescreen-rip-off-11-less-for-the-same-price.html",
"45" => "2008/03/changing-location-url-of-svn-repository-in-eclipse-1.html",
"46" => "",
"48" => "2008/09/bailout-talking-points-for-libertarians.html",
);
$item_num = $_REQUEST["itemid"];
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
if ($items[$item_num] ) {
$location = $items[$item_num];
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://$host$uri/$location");
} else {
header("HTTP/1.1 404 Not Found");
?>
<html>
<head><title>Blog has moved</title></head>
<meta http-equiv="refresh" content="3;http://<?php echo "$host$uri"?>/"/>
</head>
<body>
<h1>Blog has moved</h1>
<p>Kevin's blog has moved to <a href="http://kdpeterson.net/blog">http://kdpeterson.net/blog</a>. You will be automatically redirected in three seconds.</p>
</body>
</html>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment