it makes me want to gouge my eyes out with a cheese grater
magnify
Home Code Tumblr to WordPress, redirecting the old URLs
formats

Tumblr to WordPress, redirecting the old URLs

Published on April 26, 2012 by in Code

I’ve been blogging a long time. I’m not necessarily a popular blogger, but I do have a few posts that come up in google searches, or were linked from sites more popular than mine.

Whenever I move to a new platform I’m left with the problem of redirecting those links to the right place. Typically, this involves me wasting a day just making some sort of mapping file, and hand hacking up 301 permanent redirects.

Now, I could edit all the wordpress posts and manually change their permalink addresses to match the ones tumblr created, but I like the way wordpress generates URLs.

Fortunately, when I imported from tumblr to wordpress (indirectly, via the tumblr2wordpress converter), I ended up with a similar pattern for the post URLs on both sites.

My old Tumblr URL’s look like this:

www.reddnet.net/post/5600577691/that-place

Where the wordpress URL’s look like this:

www.reddnet.net/that-place

The URL pattern differs only in that the old one contains “post/<some number>”; which is annoying. So I went and found a nice redirect plugin that supported regular expressions. The redirection plugin by John Godley was able to handle this with grace and simplicity.

All I had to do was setup one single redirection using regular expressions:

Source URL = .*/post/\d+/(.*)
Destination URL = /$1

That’s it!

My old tumblr URLs are redirecting to the correct place. Additionally, the plugin lets me monitor the redirects, and will log any 404s for old links don’t quite match up to the new locations –which I can then fix by hand.

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
3 Comments  comments 

3 Responses

  1. Thank you sir! Just finished moving from WP > Tumblr > WP – redirect hell! Plugin helps tremendously…

  2. [...] intact, and if you’ve got a custom domain, you can point it to your WordPress install and use this plugin to set up some 301s redirects no [...]

  3. This has saved me…. thank you!

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>