article.php from geeklog

Most of my presence on the net are links to articles and howtos I've written. The majority of my blog history was with geeklog. I migrated all my geeklog stories into wordpress stories with SQL. Now I'm on wordpress and the URLS don't match. I made a quick mapping script to handle old article references.
The problem is that geeklog story references were like this.

They used article.php and a generated story id number. Wordpress stories are called posts and the main index.php page can fetch them. Plus, wordpress can use permalinks. So, it has URLS like this.


So, I did a join between the two story databases, gl_stories and wp_posts. That gave me a map from gl_stores.sid to I used some search&replace text editing to carve that map into a php array. Then wrote a quick chunk of redirect code at the end. It works champ.

< ?php

$story2postMap = array('20020509145922'=>'1',

if( isset( $_GET['sid'] ) ){
	header("Location:" . $story2postMap{$_GET['sid']} );
else if (  isset( $_GET['story'] ) ){
	header("Location:" . $story2postMap{$_GET['story']} );
	header("Location:" );
It's not fancy, but it doesn't need to be since it's a one time deal for stories that used to be hosted in geeklog. This makes it so old links to my site are still valid. I was just shuttling all links to article.php to the main page which can totally confuse you when you're trying to follow a trail of information.