I did a few navel-gazey things tonight.
Seperation of Gruedorf and State. Where ‘state’ is ‘me’.
First off, I decoupled the gruedorf RSS feed from the main feed, so I can now make non-gruedorf posts (like this one) and they won’t show up in the gruedorf feed. Yay! For the interested, the competition-only feed is at:
The “whole site” feed is at www.egometry.com/feed/.
Untangling the past
Next, I went through all of the dead links from the old version of the site that google still had, and I added 301 redirects to them all. After poking at attempting mod_rewrite exclusions on the /posts/view/ directory and failing miserably, I didn’t have a good way to make a single point of access for a lookup table and a few header() statements in php.
So instead I got the full list of urls that google was sad about via a search on site:www.egometry.com/posts. Then I methodically went though each one of the cached pages, and physically created a php file at the path expected. So if the url www.egometry.com/posts/view/21 was broken, I made a physical file that mapped directly to it (in this case /www/egometry.com/posts/view/21/index.php), and then filled it with a file with a header redirect in it. Like so:
Header( "HTTP/1.1 301 Moved Permanently" );
Header( 'location: http://www.egometry.com/gruedorf/a-hint-of-things-to-come/' );
This got really, really repetitive, but I powered through it. My shell prompt was filled with this pattern, by the end:
mcgrue@quistis:/www/egometry.com/posts/view$ mkdir 11
mcgrue@quistis:/www/egometry.com/posts/view$ cd 11
mcgrue@quistis:/www/egometry.com/posts/view/11$ nano index.php
mcgrue@quistis:/www/egometry.com/posts/view/11$ cd ..
mcgrue@quistis:/www/egometry.com/posts/view$ mkdir 37
mcgrue@quistis:/www/egometry.com/posts/view$ cd 37
mcgrue@quistis:/www/egometry.com/posts/view/37$ nano index.php
mcgrue@quistis:/www/egometry.com/posts/view/37$ cd ..
…and so on.
Why I did this insanity
The idea of having google searches for my (inconsequential) pages turning up as “page not founds” on the new site made me sad. I’d break into cold sweats at night, unable to sleep because of the thought of these poor souls wandering into my bland, unentertaining 404 page. Google analytics incoming searches would taunt me, taunt me!
Now, the solution I used wasn’t a very good one. If you had a large site it’d be plumb stupid. Apartmentratings.com had a large amount of 301 redirects from when the founder moved from his original url scheme to one that was more user (and search-engine) friendly, and it handled those in a much saner way (with a single point of conversion in the code and a datatable). But since I couldn’t work in a good mod-rewrite exception, it wasn’t that much work to do the 30-odd files manually.
So, at this point some of you might be wondering why I didn’t just use the 404 handling logic in wordpress, since the mod_rewrite for wp was obviously getting the urls in question to redirect them to the in-framework 404 page. A simple lookup-table and redirect before the headers were sent in that tree of logic would surely be what the doctor ordered, right?
Yeah, it would’ve.
I didn’t realize that until three paragraphs ago. Ah, hindsight.
My favorite post, now living at it’s new url (http://www.egometry.com/games/portal-camera-shy-achievement-tutorial-part-2/) is back in fully operational condition. I just had to massage the copy inside the lightbox links’ “title” tags so images would show up and everything would render nice. WordPress’s tendency to make \n’s, <br>’s and <p>’s into other things broke all of the markup I’d stashed away in the titles.
Anyways, I get a chuckle out of the tutorial. Maybe you will too.