Fixing the irregular

Our word “fix” comes from fixus: unwavering; immovable; constant; fixed/fastened. Well, the scottbot irregular has been slowly breaking for years, finally broke last week, and it was time to fix it.

Broken how?

A combination of human error (my own), accruing chaos, the complexities of WordPress, and the awful-but-cheap hosting solution that is bluehost.com. As many noticed, the site’s been slowing down, interactive elements like my photo gallery stopped working, and by last week, pages would go dark for hours at a time. By this week, bluehost no longer allowed me ftp or cpanel access. So yesterday I took my business to ReclaimHosting.com, the hands-down best (and friendliest) hosting service for personal and small-scale academic websites.

Quoth the Server "404"
Quoth the Server “404”

I still haven’t figured out what finally did it in, but with so many moving parts, it seemed better to start fresh than repair the beast. I’m currently working on a jekyll static website; this new wordpress blog you’re reading now is an interim solution. However, I couldn’t just cut my losses and start over, since I’ve put a lot of my soul into the 100+ blog posts & pages I’ve written here since 2009.

More importantly, my site has been cited in dozens of articles, and appears on the syllabus of hundreds of courses, DH and otherwise. If I delete the content, I’m destroying part of the scholarly record, and potentially ruining the morning of professors who assign my blog posts as reading, only to find out at the last minute that it no longer exists.

Here lies the problem. Because I no longer had back-end access to my website, I could not download my content through the usual channels. Because of the peculiarities of my various WordPress customizations, not worth detailing here, I could not use a plugin to export my site and its contents.

Since I wanted the form of my site preserved for the scholarly record, the only solution I could come up with was to crawl my entire site, externally, and download static html versions of each page on scottbot.net as it used to exist.

the old scottbot irregular
the old scottbot irregular

Fixed how?

This is where the double-meaning of fix, described above, comes into play. I wanted the site functioning again, not broken, but I also wanted to preserve the old website as it existed at the URLs everyone has already linked to. For example, a bunch of syllab(uses|i)  link to http://www.scottbot.net/HIAL/?tag=networks-demystified to direct their students to my networks demystified posts. I wanted to make sure that URL would continue to point to the version of the site they intended to link to, while also migrating the old content into a new system that I’d be able to update more fluidly. Thankfully the old directory for the site, /HIAL/ (the site used to be called History Is A Lab), made that easier: the new version of the irregular would reside on scottbot.net, and the archive would remain on scottbot.net/HIAL/.

This apparently isn’t trivial. The first step was to use wget (explained and taught by Ian Milligan on the Programming Historian) to download a static version of the entire original irregular. After fiddling with the wget parameters and redownloading my site a few times, I ended up with a mostly-complete mirror of all the old content. Then I uploaded the entire mirror to my new host in the /HIAL/ directory. Yay!

Yaaaay!
Yaaaay!

The only catch was that old dynamic page URLs, like scottbot.net/HIAL/?tag=networks-demystified, were saved by wget as static html pages, like scottbot.net/HIAL/index.html@tag=networks-demystified.html. The solution, Dave Lester helped me figure out last night, was to edit the .htaccess file to make people linking to & visiting HIAL/?tag=networks-demystified automatically redirect to HIAL/index.html@tag=networks-demystified.html

The .htaccess file sits on your server, quietly directing traffic to the various places it should go. In my case, I needed to use regular expressions (remember that thing Shawn, Ian, and I taught in The Historian’s Macroscope?) to redirect all traffic pointing to HIAL/?[anything] to HIAL/index.html@[anything]. An hour or so of learning how .htaccess worked resulted in:

RewriteEngine On
RewriteBase /HIAL/
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^$ index.html@%1.html? [L,R=301]

which, after some false starts, seems to work. The old site is now fixed, as in constant; secured; unwavering, at scottbot.net/HIAL/. The new irregular, at scottbot.net, is now fixed, as in functional, dynamic. It will continue to evolve and change.

the scottbot irregular is dead. Long live the scottbot irregular!

Leave a Reply