Migrating to S3
2013-04-28

Since my registrar provides free e-mail hosting, I decided to convert my website from dynamic PHP to static HTML pages -- which will make the site load faster, nearly guarantee uptime, and reduce my monthly costs from $6 to less than $1.

After getting rather frustrated with both jekyll and punch, I settled on middleman for the static site generator; in the end, it was the only one that was well-documented, intuitive, and flexible. It's nice to go back to essentially what we all did back in the late 90's -- upload files and wander off; generating the same page dynamically over and over again when the content never changes is pretty dumb anyhow.

While converting each page from XHTML to HTML5, I was disappointed to see so many dead links. Is nothing sacred? Unfortunately a lot of my own URIs used a parameter to point to a database key (blog.php?id=1), so I came up with a simple javascript redirect hack to keep incoming links valid:

<html>
<head>
<script type="text/javascript">
var map = {
  '/blog.php?id=1' : 'blog/2005-02-03-cvs-no-version-here.html',
  '/blog.php?id=2' : 'blog/2005-02-06-imagemagick-convert.html'
};
function onward() {
  var path = window.location.pathname + window.location.search;
  var source = path.toLowerCase().replace(/.+\//g, '');
  var target = map[source] || 'blog/';
  window.location = target;
}
</script>
</head>
<body onLoad="setTimeout('onward()', 1000)">
...