Wordpress: Moving to a New Server

Got a WordPress blog? Thinking of moving to a new server or host?

I’ve recently moved from a basic hosting package to a VPS, and part of the move involved migrating this website (a WordPress-powered blog) with all it’s essentials intact. I’d not done this before so I relied heavily on advice from the interweb to help me along the way. The trouble is I couldn’t find a single solution that worked for me 100%, so I thought it may be helpful to detail my experiences here.

First of all lets consider my original setup: I don’t know the details of the box, but I opted for a Windows 2003 Hosting package. Not the first choice for a WP blog, but I had other needs that required ASP.NET support. The package ran from an IIS server with PHP5 and MySQL5 installed, and WordPress seemed quite happy

My new server (a VPS package) is a similar setup but with more dedicated resources. All the same Windows 2003/IIS6/PHP5/MySQL5 are there with the only key difference being the MySQL server is running on the same machine as oppose to a dedicated database server.

My first though about migration was, apart from the database, it should simply be a case of copying the files across to the new server. I did a bit of searching around and found a number of articles that described just this approach. So off I went. My old host gave me the facility to export/backup any MySQL database, so all I needed to do was copy the resulting .sql file to the new server, open the command prompt and type:

C:> mysql -u USERNAME -p

(Enter your password to enter the MySQL shell…)

mysql> CREATE DATABASE wordpressdb;


> ON wordpressdb.*

> TO 'wp_user'@'localhost'

> INDENTIFIED BY 'wp_password'


mysql> exit

(Now you’re back to the command prompt where you can type…)

C:> mysql -u USERNAME -p -h LOCALHOST wordpressdb < c:dbToImport.sql

… and a few seconds later you’re done.

The problem with this approach is it just didn’t work. I followed various variations of the steps described by other uses, and even resorted to stripping down my existing WP blog to the bare essentials (uninstalling most plugins, etc). Still no joy. WP worked fine before the import of the database, and then just died with a white-screen-o-death after import. Dang!

After about two hours of this I decided to give up. There was clearly something not playing ball, so what was needed was an alternative. I knew that WordPress has a Import/Export feature for porting all your pages, posts, comments, etc. Although it sounds ideal, I’d avoided it at first as it only deals with the content of your site. Not *everything* is copied. I decided to bite the bullet and go for a clean install of WordPress.

So, I deleted everything and apart from a visit to my old blog to create the WordPress export XML file, I just proceeded as if I were setting up a new WP site.

Once up and running I ran the import function, and sure enough everything imported … almost. Rather annoyingly, the export feature within WordPress doesn’t include everything you’d expect it to. The most glaring omission is your Links. None of them, including the link categories, get exported. How odd!

The other more obvious content-type that’s missing (given it’s only an XML file) is your media library. For most users this will simply be fixed by copying across the contents of your old “wp-content/uploads” folder – but be warned this is only a solution if you’re taking your domain name with you. If you’re moving to a new domain you’ll discover  that all the URLs for your images are absolute links to your old domain. Nghh! Luckily for me, once my domain was transferred to the new server that problem sorted itself.

Finally there was the task of reinstalling my theme, plugins and settings. In all it was not the one-click migration I hoped for, but in another way it forced me to tidy everything up a little which is never a bad thing.

While I wouldn’t expect WordPress to export it’s image library along with the content, the lack of links really surprised me. Surely that’s something that should be fixed in an upcoming release. The other annoyance turned out to be WordPress’ use of absolute URLs for images you have in your media library. That seems inefficient and unnecessary, and will only lead to tears during a move to a new domain. Consider yourself warned!

Anyway. Welcome to the new-look olitee.com: Created with blood, sweat and many tears.