This blog now has its own domain and is hosted on Microsoft Azure. In retrospect, I should have taken notes and screenshots as I was going through the process but I got too caught up with the task at hand and now, all I have to show for it is a moved blog and a hand-wavy blog post. But just in case I choose to do this again, at least this much will have been documented!
The first part of the process involved backing up the blog files from the old domain and restoring them on my local computer. I then created a Visual Studio 2012 Web Site project and pointed to the folder where I’d restored the blog files. This meant I could then use Visual Studio as a publishing tool.
Since the domain had changed, I searched through the project files and changed any hard-coded links to the new domain. There were a fair number of those, which, as a developer, I found somewhat disappointing.
On Azure, I created a new website, configured it, and downloaded the Publish Profile. This, I used to configure my project’s publishing functionality so Visual Studio would know where to publish my site to .
I then backed up the original WordPress MySQL database using the WordPress Database Backup plugin and sent the resulting file, which consists of a drop / create table script with insert statements for the data, to the Azure server. Restoring it for use on Azure should have involved simply creating a MySQL database on Azure and running the script file. The part that caused me the most grief in this whole process occurred right here. Not only did the source code contain umpteen references to the old URL, so did a number of the database records. So a search and replace had to be done throughout the database script before executing it in order to get the right data. Some of the records even contained a length field so that also had to be adjusted to compensate for the new domain name’s length compared to the original one.
Once I had the database created correctly, I went back to Visual Studio. Here, I modified the wp-config.php file to contain the new database connection string information. Finally, I right-clicked on the project and Published it.
It took several iterations in order to get all these bits aligning correctly. Indeed, the first time I tried publishing and running the blog, I hadn’t yet realized there was a database associated with it so I got an HTML 500 error. I used Fiddler to get more information and realized it was complaining about a connection string being incorrect. That’s when I clued in that I had to back up a database and set it up for the new blog.
Previous to this, I knew as little about WordPress as it’s possible to know and still run a blog using it. I had never modified .php files and had never consciously worked with MySQL. And I certainly hadn’t done anything with Azure. So this is all new to me.
If I’d been smart, I would have searched the web for a list of steps on how to move a WordPress blog. I’m sure they exist. But while my ad-hoc approach may have caused more churn than necessary, I sure learned a lot!