Redirecting Old Wordpress Articles to SubText Articles After Migrating Blogs

Since I recently migrated all of my blogs to SubText, I wanted to make sure that anyone visiting the old links on my Wordpress blog were automatically redirected to the new location of all the past articles.  I have been blogging "on record" since April of 2000.  By "on record" I mean that I still have the posts going back that far within this blog.  That's almost seven years!  Obviously there is a lot of content and things are linked from all over the Internet.  Trying to minimize the move damage here is what I did to redirect the old blog URLs to the new location in SubText.

If you are migrating from Wordpress to SubText, add the code below to the top of your index.php file and of course change the URL to match your own.  It should be fairly simple to understand.  The code takes the incoming REDIRECT_URL server variable and checks to see if it ends in a slash or is just a slash.  Depending on state, a URL string is built up which points to the new location of the article within the SubText blog. 

In order for this to work flawlessly, when you import your Wordpress articles into SubText, be sure you save the data in the database column called "post_name".  This is the column that takes the titles and replaces spaces with dashes and so on.  Otherwise you'll never get a match via the title.  As a result of adding this to Wordpress anyone visiting an old link will be redirected.

Example

http://blog.zorka.com/2001/03/18/priceless-for-everything-else-there-is-mastercard

will now redirect the user to:

http://keithelder.net/blog/archive/2001/03/18/priceless-for-everything-else-there-is-mastercard.aspx

 

As a side benefit that I didn't think about when I originally wrote this is it allows links that view postings by date to be redirected as well. 

Example

http://blog.zorka.com/2001/04

will be redirected to:

http://keithelder.net/blog/archive/2001/04.aspx

posted @ Wednesday, January 03, 2007 9:48 AM

Print

Comments on this entry:

# A Seven Year Blogger Recounts His Blogging History

Left by Words of Wisdom From The Elder at 1/6/2007 10:35 AM

A Seven Year Blogger Recounts His Blogging History

# re: Redirecting Old Wordpress Articles to SubText Articles After Migrating Blogs

Left by AtomicInternet at 1/9/2007 8:24 AM

Hooray! Finally I can comment on your blog without a login. The world is right again.

# re: Redirecting Old Wordpress Articles to SubText Articles After Migrating Blogs

Left by AtomicInternet at 1/9/2007 7:51 PM

Just an FYI, your comment section goes all funky in IE7. Fields are all over the place.

Your comment:






 
 
 
Please add 1 and 7 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011