The Painless Way to Migrate a WordPress Blog
First, let me say that the Drupal tutorials are on the burner, and I will be posting the first segment soon. But today I want to talk about moving a blog. I’ve had some hosting issues that have forced me to consider terminating my relationship with one of my webhosts. This means, of course, that I must move my websites that are hosted on that server to another server, a process that I was dreading with all my heart, because there are databases and so much customization involved and I am terrified that I will mess up and lose a lot of time.
I started the migration process with several blogs/websites built on WordPress, and it was a surprisingly painless process that didn’t require me to touch the database or any config files. Bear in mind that the blog was maintaining it’s name and domain name, and all I was changing was webhosts. I will go step by step to describe what I did. First, let me say that I tested this method by creating a subdomain on one of my other domains on the new server and transferring the blog there, to make sure it would work, so that helped reduce my fears.
- Back up all files and database: As always, whenever you’re planning to make any major changes, you want to make sure you have current backups on your computer. So using cpanel, I downloaded a backup of the WordPress database, and then downloaded the whole folder that my website was in using FireFTP. This is an important step because it will allow you to recover your files should anything go wrong. You will also need the wp-plugins and wp-themes folders for your new setup.
- Create and Export an XML file of the blog: This is what makes the migration so painless, that new versions of WordPress have this capability. While in the admin area, click on “Manage” and then open the “Export” tab. This creates an XML file that you will then use to recreate your blog. Since my blog has only one author I didn’t need to use the filter, so I just hit “Download Export File”. You want to make careful note of where you save this file.
- Change DNS settings for domain name: Once I had my backups saved, and I had exported the XML file onto my desktop, the next step was to transfer my domain name to the new webhost (Hostgator) where I wanted to set up the blog. This was simply a matter of changing DNS settings at my registrar. I logged into my GoDaddy account and made the changes, and waited for the confirmation email so that I could continue.
- Install WordPress: Once the domain name changes showed up in my email, I then proceeded to the cpanel for my new webhost, set up the domain as an addon domain and installed the latest version of WordPress on the domain name. I then logged into the new WordPress install, and deleted the default post, page, and comment.
- Import posts into the new blog: Now that I had a clean install of WordPress running, I imported all my posts from my old blog into this new one. The process was pretty much the same as exporting. In the admin area, go into “Manage”, and select the “Import” tab. Choose WordPress as your source, and then hit browse and navigate to where you saved the XML file you downloaded in Step 2. In my case, I used the same username creating the new blog as the old one, so I just used the default import setting for the author. Voila! My posts and comments were all imported!
- Restoring themes and plugins: The next step was to set everything up the way had it on my old blog, including ads, Analytics, and all my plugins. Again this proved to be really simple. Using my FTP program, I uploaded the wp-plugins and wp-themes folders that I had downloaded from my old location and overwrote the new ones. I then had to go into “Presentation” and select the theme to activate it. To restore my plugins, I found I had to go into “Plugins” and reactivate them all to et them working again, but that was pretty trivial in this case. If you have uploads you may want to upload the whole wp-contents folder.
- CleanUp: The last clean up steps involved scrutinizing my blog and making sure that everything was in order. Sometimes you link to other files that aren’t necessarily in the WP folder, such as images you may have saved somewhere else, so you want to make sure you check all that and migrate any other external files as needed. I also needed to clean up the blogroll. Once I was satisfied that the new blog was working like it should, I then went back to my old hosts and deleted all the files, the database, and the addon domain.
So in less than 30 minutes, I transferred my blog with all my posts and comments from one host to another. That was pretty painless!