At first I intended to just add the top level domain of restofthe.net to Blogger and keep the management there, but this was on the assumption that Blogger could just put a HTTP 301 Permanent Redirect on all the restofthenet.blogspot.com pages to the equivalent restofthe.net page and the transition would be seemless.
Although the restofthenet.blogspot.com did redirect to the equivalent restofthe.net page, it would use an extra redirection page saying that it was being redirected away from Blogger (which it technically wasn't). I rolled back this transition and decided another method.
The content on restofthenet.blogspot.com was being indexed nicely by Google so I didn't want to mess with that, so decided to have a redirect on that page to restofthe.net.
The method I chose was a timed meta refresh, it could also have easily achieved using javascript, but meta refresh I decided was most widely compatible. It works by putting the following code in the <head> of the page HTML.
Code:
<meta http-equiv="refresh" content="5;url=http://restofthe.net/blogger.php" />
Edit: I noticed that the referrer was not being passed on by Firefox nor IE. So I changed to use Javascript and pass referrer through query string. Add the following code in the edit HTML template OR as a HTML/Javascript widget page element.
Code:
<script type="text/javascript"><!--
function redirect() {
window.location = 'http://restofthe.net/blogger.php?' + window.location;
}
setTimeout('redirect()', 5000);
//--></script>
Now I need to have the content at the other end. Using the Blogger export tool, I was able to take everything from Blogger and import it into new management software which I hosted at a Web host. On the software I made the urls using url rewrites as close as possible to the original Blogger urls, to make redirection easier.
The Blogger format for posts was /<4-digit year>/<2-digit month>/<post title>.html, the format for montly archives were /<4-digit year>_<2-digit month>_01_archive.html. The format for posts on the new software was almost the same with some exceptions, the monthly archive was simply /<4-digit year>/<2-digit month> not ideal but easily rewritten.
I created a blogger migration page in PHP called "blogger.php" to handle all the rewrites based on the referring page. Notice that this is the page that the meta refresh directs to.
Code:
<?php
// Redirect from blogger
$dest = 'http://restofthe.net/';
$ref = $_SERVER['HTTP_REFERER'];
header("HTTP/1.1 301 Moved Permanently");
if (!$ref) { $ref = $_SERVER['QUERY_STRING']; }
$matches = array();
if (preg_match('@^http://restofthenet\.blogspot\.com@i', $ref)) {
// Custom matches to fix special cases
if (preg_match('/game-sling\.html$/i', $ref)) {
header('Location: http://restofthe.net/2006/09/sling.html');
} else if (preg_match('/game-picto.html$/', $ref)) {
header('Location: http://restofthe.net/2006/10/picto.html');
} else if (preg_match('/thetoddtimecom\.html$/i', $ref)) {
header('Location: http://restofthe.net/2007/02/thetoddtime-com.html');
} else if (preg_match('/flashy-business-card-trick\.html$/i', $ref)) {
header('Location: http://restofthe.net/2007/02/flashy-business-card-magic-trick.html');
} else if (preg_match('/cocktail-tricks-at-tgi-fridays.html$/', $ref)) {
header('Location: http://restofthe.net/2009/12/cocktail-tricks-at-t-g-i-fridays.html');
// Archive match
} else if (preg_match('/(?<year>\d{4})_(?<month>\d{2})_01_archive\.html$/i', $ref, $matches)) {
header('Location: '.$dest.$matches['year'].'/'.$matches['month']);
// Standard Post match
} else if (preg_match('/(?<year>\d{4})\/(?<month>\d{2})\/(?<title>.+)\.html$/i', $ref, $matches)) {
header('Location: '.$dest.$matches['year'].'/'.$matches['month'].'/'.$matches['title'].'.html');
// Unknown send to front page
} else {
header('Location: '.$dest);
}
} else {
// Not Blogger redirect send to front page
header('Location: '.$dest);
}
?>
Edit: Added $ref from QUERY_STRING for javascript redirect in above code.
Lastly a notice to inform people at the restofthenet.blogspot.com about the transition to restofthe.net and they will be automatically redirected.
Unfortunately I wasn't quick enough for the original blogger redirect to start tainting Google cache for those cute kittens, but it saved other pages and I hope this will help anyone else out there.
Quote:
Blogger: Redirecting
Blogger is a free blog publishing tool from Google for easily sharing your thoughts with the world. Blogger makes it simple to post text, photos and video ...
restofthenet.blogspot.com/2006/10/cute-kittens.html