About a year ago, I built a wine rack out of an Ikea bed and blogged about it. I sent it in to Hack a Day and they promptly posted it. Then Lifehacker featured it, and this has become the most frequently visited blog post I've ever composed. Now that I've gone "minimalist" on my blog (all static HTML with RuhOh), I didn't want these old links to go dead on Hack a Day and LifeHacker. They are linking to a Drupal URL that refers to index.php and a query string with the Drupal node number. Not exactly easy to make static.

When I converted my old Drupal posts to static HTML using Jekyll, it conveniently arranged them all into permalink style folders based on date (year/month/day). Jekyll also created markdown files in folders by node number with meta data at the top that tells Jekyll (or RuhOh) how to find them by permalink. So I got the idea to make a static HTML file but name it index.php and put a little javascript in it that reads the query string then redirects the browser to the relevant node folder. So I came up with this:

    uri = new miuri(location.href);
    window.location = uri.query('q');

MiURI is a simple URI parser in Javascript that I included in the index.php. That's all it took, so now all my old index.php links out there in the internets still work.