How to migrate your wordpress to tumblr. Including images and comments.

2012-12-14

So I’ve decided to move my wordpress blogs to tumblr. Although apparently TechCrunch thinks that’s a bad idea. And although Moritz Adler would kill me for that. (Although: He doesn’t have a personal blog and hence has no licence to kill me). Anyway. With tumblr I don’t need to host a blog software myself. And I don’t end up having my blog hacked and then seeing my blog being displayed as a malware site in Chrome/Firefox (happened to me twice). And then with tumblr I create new blogs with subdomains within minutes. Cool stuff. Hail to the cloud, baby!

So here you go: A complete guide how to fully migrate your wordpress blog to tumblr. Including comments and pictures. And still supporting your old url scheme.

Update: I ran into a tool that claims to do a lot for you: import2.com/tumblr. It doesn’t migrate images and 302 redirects. Not sure about comments migration. And it costs 24$. Still, if you can leave out some of the steps below that’d be worth the money. Comments of the author on quora

Before you start

Before you start to actually move your blog, you need to consider a few things:

Where do you move your DNS to?

If you have a wordpress webhost, then this webhost most probably also does DNS for you. You need to replace that by a third party solution. I think these are good services:

he.net. Free service. No strings attached. The one I’ve chosen. The interface is nice and very easy to add new CNAMES, MX records, etc. The uptime was reported to be not so good, but I don’t really care about uptime of my blogs. To host your tumblr blog on your domain, you add a CNAME to domains.tumblr.com and then configure your tumblr blog to listen to that domain. Very simple.

Amazon Route 53: They charge you $0.50 per hosted zone per month. That’s a fair price and probably has a better uptime then he.net

What do you want to do with your images?

At default they’re all located under www.yourolddomain.com/wp-content/img1.jpg. To completely get rid of your old web host you need to move those to a different image hoster. I don’t advice you to upload it to tumblr because if in future you want to move away from tumblr you run into the same problem again.

Would you like to keep your comments?

Do you have comments at all? Tumblr doesn’t support comments by itself. Most themes have disqus support. Moving comments to disqus is no big deal, but still it’s some work, so you may decide to just not migrate comments.

Are you keen to not break your old blog urls?

Wordpress’ url scheme generally is e.g. code.pui.ch/2007/01/05/print-hello-world/.That same post ends up at this tumblr url: howto.pui.ch/post/37471154429/print-hello-world. Note that the last part of the url is optional, i.e. howto.pui.ch/post/37471154429 works as well.If you care about incoming links to your blog not to break and if you care about your google ranking (I guess 302 redirects inherit the google ranking), there are two possibilities:

Stay on the same domain, handle the redirects in tumblr (tumblr supports that with the pages’ type “redirect”)

Move to a different domain and put up e.g. redirect permanent in a .htaccess file on your web server

A rough outline of what you’re up to

At a glance, that what you’ll do:

Upload your images to a different hoster (if you want to get rid of your old webhost)

Step 1: Upload your images to a different hoster

If you’re ok with keeping your old webhost you can skip this point. Easiest thing to do would be to copy your wp-content directory one to one to a different hoster so www.yourolddomain.com/wp-content/img1.jpg turns into http://www.imagehoster.com/my_user_name/img1.jpg.

I don’t have experience with image hosting providers so I just uploaded my images to picasa, but that meant I needed to update every single image in all my blog posts to the new image url of picasa. That was quite a pain. I couldn’t find a image hoster yet who meets the criterias above. Photobucket doesn’t, Dropbox doesn’t, Google Drive doesn’t. Maybe Amazon S3

Step 2: Extract your blog posts+comment from wordpress

In your wordpress admin go to Tools → Export. On my blog that was code.pui.ch/wp-admin/export.php.

Choose All content, Download Export File.

Step 3: Fix the export.xml

You have just downloaded an xml file, in my case the name was coderandom.wordpress.2012-12-13.xml. Open that file with your favourite text editor. Now you need to do a few things before you can go on:

Replace all <!–more–> by [[MORE]]. The uppercase actually matters. [[MORE]] is the divider that tumblr actually understands as the place where you want your excerpt to stop in the blog overview view.

Replace all images by the new urls you got by uploading the images to the image hoster in step 1. It’s much easier to do this at this stage than to replace the images once you’ve migrated your blog to tumblr.

You may have more wordpress plugins you used in your posts. I used [python]...[/python] to syntax highlight my python markup. I’ve moved to google code prettify which needs &lt;pre class="prettyprint"&gt;...&lt;/pre&gt; as a syntax. So I needed to replace all occurrences by the new markup. Obviously, regex is your friend at this stage.

Step 4: Migrate your wordpress blog to blogger

Unfortunately there’s no direct way to directly import this xml file into tumblr. Instead, that’s what you need to do:

Convert your xml file on this website to a file fit for importing into blogger.

This doesn’t work for files bigger than 1MB. If that’s the case then you can either convert the file on your own machine using this sourcecode on google code.

Step 5: Migrate your blogger blog to tumblr

Go to bloggertotumblr.com and enter your url for your newly created blogger and tumblr blogs. The conversion is very straight forward.

Delete your blogger blog

Enjoy. Your blog posts are now on tumblr. Still missing: Support of the old url scheme and comments

Step 6: Install http redirects (on old webhost or on tumblr)

In the section before you start I asked you to decide if you’re ok to break your old urls. If you don’t care, then skip this step. Although: if you care about keeping your comments then you still might to do this step, as it makes migrating comments to disqus a lot easier

If you do care, then:

If you keep the domain of your blog: You need to install tumblr redirect pages. See below.

If you changed the domain of your blog: You need to install redirects on your former wordpress webhost. I describe how this is done via .htaccess config below

Install tumblr redirect pages

go to your new tumblr blog

click customize top right

add a page (left column)

instead of “Standard Layout” choose “Redirect” and add a posts’ old url on top, and the new url on bottom. Repeat this for every blog posts (yeah, lots of work here)

Install .htaccess on your old webhost

IMO that’s a bit simpler than installing a tumblr redirect for every blog post. Still it’s a lot of work since you need to come up with a map of old_url → new_url for every blog post. If your webhost supports .htaccess then go for this method. Most probably you have such a file already for your wordpress installation.

Note the first 3 lines, you will need the same for your redirects. Note the special syntax of line 3. That is important to not redirect a non existing url to the new domain.

Wait! I just moved my blog away from my old webhost, and now I need to keep it to have http redirects in place?

Uh, yes. Alternatively, you can move to a free hoster like google apps engine and e.g. use this to redirect. Or you just wait a few months and wait until all search engines have digested your redirects and kill your old webhost only then (that’s what I’m probably gonna do).

Step 7: Migrate your comments to disqus

Because tumblr doesn’t offer comments by itself you need to migrate your comments to disqus: