Since upgrading my blog from WordPress.com to a hosted WordPress.org installation, I’m only now realising how good WordPress is and how simple they’ve made the migration possible.

The free blogs are great for getting started – and that’s not to say only for ‘getting started’, I used their solution for two years without a single problem. I upgraded to have more control, with regards to embedding media, handling uploaded files and because I’m keen to get something on my http://www.marchibbins.com/ domain soon – previously it redirected to my WordPress.com by web forwarding.

I obtained my hosting from WebFaction and without too much of a sell, they’re pretty awesome. They offer an unlimited number of sites, databases and email accounts, SSL support, SFTP, SSH and full shell access – you can literally install any applications you want on there.

As well as that they have a good number of applications ready to go via their control panel. One of these is WordPress.

I didn’t want to start this new blog from scratch and I didn’t want posts duplicated on the new domain and still existing on my free blog – this is a bad thing. I also didn’t want to delete the old posts and leave an ‘I have moved’ notice, because I’m aware of incoming links that would return HTTP 404 (file not found) errors. I wanted to keep all of my posts, preferably hosted now on my new hosting, maintain the old links even though the web address would be different – and do all of this seamlessly so no-one would really realise. My solution was in two parts.

Domain Mapping

One of the great things WordPress offer is Domain Mapping, which basically means your blog can be at WordPress.com but it looks like it is somewhere else – on another domain (support page here). It’s a paid upgrade and requires you having a domain registered first, of course.

It makes use of the ‘Domains’ feature, you can access it from the Dashboard, which can be set to forward all requests to your blog to the equivalent URLs on a new domain. For example, visitors to http://yourname.wordpress.com/about/ would be automatically redirected to http://yourname.com/about/, same as visiting http://yourname.wordpress.com/2009/04/29/post would take you to http://yourname.com/2009/04/29/post.

To do this (as the support guides you) you need to first update the nameservers with your domain registrar, which means the domain name will point to WordPress’ nameservers instead of theirs. The WordPress nameservers are as follows:

ns1.wordpress.com
ns2.wordpress.com
ns3.wordpress.com

And the if the registrar needs the IP addresses:

72.232.101.25
76.74.159.137
64.34.177.159

Changing the DNS settings can take up to 72 hours to propagate, so don’t expect to see results immediately – but it’s often less.

Once this is done, you should be seeing WordPress.com at your domain name. Then in the Domains section of your blog Dashboard (under Settings), add your new domain. Here you will be asked to purchase the Domain Mapping upgrade here if you haven’t already. Then set that new domain as your primary URL and from then on, all requests should be forwarded!

Subdomains

For my blog though, I wanted to map to a subdomain, specifically http://blog.marchibbins.com/ rather than the http://marchibbins.com/ top-level domain. To do this you don’t change nameservers, instead add a DNS CNAME at your DNS provider (this is on the support page, too).

Doing this manually will look something like this:

subdomain.yourname.com. IN CNAME yourname.wordpress.com.

In my case, I implemented a DNS override with my WebFaction hosting (a feature that they offer) and after 24 hours I could see WordPress.com, so upgraded and added my domain name in the same way. That’s the first part – and this meant any old links (and links within posts to other posts) would be still find their destination.

Switching to WordPress.org

As I said though, this simply forwards your free WordPress.com to your new domain. This doesn’t even require any hosting, just a domain registration. But I wanted the features and control that WordPress.org offers.

Now that the domain mapping was in place, I removed the DNS override, meaning that the ‘blog.’ subdomain no longer pointed to Word press. Instead, I installed the full version of WordPress 2.7.1 there.

Then I exported all my blog posts, comments, categories, authors – everything – from my old blog (this is done through the Dashboard with a single XML file) and imported it into my new blog. I also found my old theme and updated all my links etc – basically rebuilt my old blog on the new platform. This is super-easy and easily accomplished before the DNS has updated.

This means that all requests are still forwarded as before, but instead land at my newly installed WordPress.org blog and the relevant post there!

Doing this does have some dependencies – the posts need to have been imported, they cannot be republished, because this would give them new unique identifiers and the forwarding wouldn’t find them as a result.

Similarly, the the structure of your permalinks must be consistent – requests are forwarded without regard for what is at the destination, the URL string is appended verbatim. This means if you used something like http://yourname.wordpress.com/2009/04/29/post you can’t then use http://yourname.com/?p=50.

It also means the previous blog is now hidden, done and dusted.

New comments to your new domain won’t be added to your old blog, though that shouldn’t really matter as it’s inaccessible now – so the posts aren’t ever seen to be ‘out-of-date’. The stats will also cease, as no-one is visiting that blog anymore, they’re visiting the WordPress.org installation – so install a stats package there!

Another handy outcome of the mapping means that RSS subscribers should still receive updates. Even though the WordPress.com blog feed is no longer being updated, the request for http://yourname.wordpress.com/feed/ is forwarded to your new blog’s feed – and that’s how they’ll be seeing updates, hopefully including this post!

The night’s busting open, these two lanes will take us anywhere.