WordPress: How to make the switch to self-hosting

I started my “perfessional” blog sometime last year, and decided to go with a hosted WordPress site (i.e., something hosted on wordpress.com’s domain, no software install necessary). It worked at the time, and the barrier to entry was low. Sign up, pick a theme, tweak the CSS for an hour or so, done. It was easy and it got me going. After using it for awhile, I realized that it didn’t give me the freedom I needed. So, after a bit of teeth-gnashing, I decided to take the plunge and switch to self-hosted WordPress (i.e., on my own domain, software installed and maintained by yours truly).

It’s do-able, but involves a little DNS tomfoolery…

Why make the switch?

WordPress offers the ability to do domain mapping (i.e., point yourdomain.com to yourdomain.wordpress.com). So why bother going to the trouble to put up and maintain my own site? A few reasons:

  • Unlimited customization: I can add any plugin I want, or even create my own
  • Ability to create apps (or whatever): If I want to design and build little web apps or widgets, I can create, upload to my server, and voila…
  • File hosting: I can keep files on my server, and provide links for download
  • Beta versions of WP: I can install whatever version of WP I want, including beta versions (like this one)
  • Themes: I can create my own custom theme if I find myself with a lot of time on my hands

How to make the switch

If I didn’t care about the old WordPress URL mapping to my new one, switching would have been easy. I would have just exported my old blog, imported into my new one, and cancelled the old service. Unfortunately, I printed a bunch of business cards with the URL for my hosted WordPress site (bitstrategist.wordpress.com), which meant I needed to keep that domain alive somehow and point it to my new domain (bitstrategist.com). SEO optimization was also important, just in case there are links to the old site floating around in search results. So, I needed to map the old domain to my new site.

As it turns out, this is possible, but a little tricky (and it costs money). Here’s what I did:

  1. Register domain: I went through the hosting service I use for my other web site (Mediatemple) and set up another domain.
  2. Install WP: Download the latest version of WordPress from wordpress.org and install it on the new domain
  3. Export: Dump an XML version of my hosted site
  4. Import: Pull old content into my new, self-hosted version of WordPress. Note that when you import the XML file from your old site, you’ll need to tell it to include an import any images used in your posts or pages.
  5. DNS redirect, Part I: This is the tricky part. In order to set things up right with WordPress, you need to do a domain mapping for your new domain (see note below about DNS and domain names). WordPress won’t let you do this unless you’ve set its DNS servers as those used for your domain. In my case, this meant going into my domain control panel on Mediatemple and pointing my DNS to WordPress’ servers. This setup is only temporary; you just need to do it in order to create a WordPress domain mapping.
  6. Wait: Any time you change the authoritative DNS servers for a domain, it can take up to a day for the change to propagate through the system, so you have to wait. Once the change is complete, you’ll know because typing in yourdomain.com will redirect to yourdomain.wordpress.com. So I waited for a day.
  7. Enable domain mapping: Within the WordPress control panels, I enabled domain mapping, since WordPress was able to see that its domain servers were responsible for my domain (bitstrategist.com). FYI, domain mapping costs $10/year.
  8. DNS redirect, Part II: With domain mapping enabled, I went back to my domain registrar and changed my DNS settings back to what they were originally (i.e., before entering the WordPress DNS server information).
  9. Wait: Once again, because DNS settings were changed, I had to wait for the changes to propagate.
  10. Customize and Enjoy: Once the DNS changes propagated, my new self-hosted WordPress site was up and running, and the old hosted site just redirected visitors to my new one. I didn’t change any of my permalinks, so deep links work just as well as top-level domain redirects. All was right with the world. All I had to do next was install the plugins I wanted (e.g., Twitter integration, links to other social network services), customize my CSS, and then let it rip.

Appendix: A few words about DNS

Some of you may be wondering what the heck a DNS server is and why you need to deal with it when switching WordPress sites. The Domain Name System (DNS) is the underlying naming protocol that makes the Internet work. Every machine connected to the Internet has a numerical address (an IP address). This address is kind of like a street address, only for the Internet. DNS is the system by which human-readable names get mapped to the numerical IP addresses used by the underlying network. For example, when you point your browser at google.com, it makes a request to a DNS server, which responds with (one of four IP addresses that map to Google’s domain). There’s one server out there that acts as the authoritative resource for every address. The information from that server is then replicated on other servers around the world, so that name queries can happen quickly (i.e., to servers that are physically nearby).

In the case of WordPress domain mapping, you need a way to have yourdomain.wordpress.com point to yourdomain.com, so that when people type in the former into their browser, they actually get sent to the site at the latter address. When you set up a self-hosted WordPress domain, here’s what happens:

  • Self-hosted URL: When people type in the URL for your self-hosted site (in my case, bitstrategist.com), the DNS information sent out by the authoritative server at your domain registrar is used to figure out where your site is.
  • Old WordPress URL: When people type in the old, hosted URL (in my case, bitstrategist.wordpress.com), they get sent to the WordPress domain (since WordPress DNS servers control anything related to wordpress.com). WordPress, however, knows that a domain mapping has been set up, so they just take the request and reroute it back to the primary domain (in my case, bitstrategist.com).

Easy, right? Right. 😉

This entry was posted in Web stuff. Bookmark the permalink.