Because 2 years of “file not found” is long enough.

Every so often, I have such an idiot moment that it takes me forever to realise I was a complete moron. One of those moments happened, sadly enough, during the rebirth of the blog on this domain. For folks who’ve been keeping score, I’ve actually shifted blogging platforms twice–once from Movable Type to LiveJournal, and then from LiveJournal to WordPress. In all that time, while folks could always see the old blog over here, that left a gigantic hole on this site–one that quickly filled up with requests for pages that no longer existed. Enter the moronic that is me.

Being that I deal with computers, the interwebs, and things that make both tick on a regular basis, you’d think I’d of clued in on this a lot sooner than I did. Turns out–and I should have known this–search engines, other websites, random spambots etc don’t actually stop looking for a page just because said page stopped existing in 2008. Nor, for that matter, does anyone actually correct broken links it would appear. And, since until this morning I didn’t even have a clue how to go about doing that, they just kind of sat there returning the standard 404 request.

Fortunately, because the year I was on LiveJournal meant I wasn’t using this domain for it, there’s that much fewer posts I had to worry about correcting. That just left the 600 and change from the old MT install. Three hours on Google, various message boards, and other asorted sites later, I came across what I think might just be the almost right solution for that particular problem. After testing it on a handful of posts that I’ve been able to confirm were tossing back 404 errors, and finding them no longer doing so, I can safely say the blog now works entirely–or virtually so, if nothing else–the way I originally intended to.

The how and the why is semi-technical, though if anyone’s interested in the boring details I’ll be more than happy to elaborate. But, the short version goes something like this. Movable Type, for all its usefulness, had one huge drawback. It built static HTML files. Which, okay, made serving posts etc pretty much amazing. But once you got up to a certain amount of activity–the publishing of new posts and comments–the rebuilding of those static HTML files took about a hundred years. It also didn’t allow for a whole lot of flexibility in how you linked to those files. If you changed the post title and wanted to update the permalink to account for the change, MT didn’t give you much support for redirection to the new URL. You pretty much had to change it manually, then provide the redirection manually. Adding to the complication that is MT’s way of doing things, the directory structure it came up with was something like: http://www.the-jdh.com/2010/06/05/some_post_title_here.html . WordPress, on the other hand, goes more along the lines of: http://www.the-jdh.com/2010/06/some-post-title-here/ . Ignoring the arguments as to which one’s better than the other–I don’t really care to be honest, it presented a small problem post-migration. Problem solved.

A little addition in plugin form to WordPress, and the URL you request from the server suddenly serves a secondary purpose. It gets handled in this way.

  • If the post and/or page requested exists, serve it as per normal.
  • Failing that, scan the current list of posts/pages for a post who’s title matches the keywords available in the URL.
  • If a matching post is located, redirect the browser to that post and hope that’s the one they were looking for.
  • If nothing is found, return the standard 404 page as per usual and get on with the normal routine.
  • If more than one option is found, then, optionally–meaning whenever I get around to implementing it–provide a list of suggested entries similar to what was detected in the URL.
  • If none of those applies, then we have a bigger problem than I thought and I really should consider not tweeking the site while half a mile from no sleep.

Since nothing’s blown up at me during my testing, it’s a pretty safe bet things are at least 90% not broken. Or they’re clever about hiding their brokenness. Now, about that half a mile of sleep thing. Time to go fix that next.

Leave a Reply

Your email address will not be published. Required fields are marked *