News

Move WordPress Site to New Domain Using WP Migrate DB

By November 16, 2015 March 24th, 2016 No Comments

AKA 5 Steps to a New You Domain Name

This post is an answer to multiple client and colleague questions about how to move a WordPress site to a new domain. There are a lot of different ways to do this, as you will find from Google, but this is the method I use after building a couple hundred sites. I will start with common questions and answers before the how-to. Whether you are moving to a new server, changing the url of your site, or both, these questions are likely to come up.

Can’t I just change the address on the settings page?

Nope. The reason is that WordPress uses absolute URLs in posts and pages. There are ways around this, but it means that the address of your site is stored in many more places than just the setting table.

Can’t I just move the files?

Nope. WordPress depends on a connection to your database. You need to move files AND database to the new server.

Can’t my new host just migrate it for me?

Maybe. It depends on their knowledge and your setup. Typically hosts are offering to migrate a full cPanel configuration which might include much more than your site. This posts focuses on moving one site.

So what’s the worst that can happen?

Losing a LOT of data. Specifically, WordPress stores widget data and some themes store theme configuration data in serialized arrays. Google that if you want to fall asleep. The point is, those arrays can be damaged easily when you perform a site change and you’ll find yourself repeating work or trying to recover data. Been there. Done that. Not fun.

Ok, so let’s get into the recommended process now. Here are the 5 steps:

1. Backup

In case you’re tempted to skip this step, how many hours of work will you lose if this doesn’t work? Ok, then, I recommend UpDraft Plus as a quick solution to providing a backup. Your host may also offer this, but be clear on what else gets reverted when you restore your backup. I also recommend running all available updates at this point.

2. Export Database

Load up the WP Migrate DB plugin, activate it and go to the settings page. You only need to fill out two fields, but could get away with just the address field. I prefer to not gzip the file as it makes the import later easier.

3. Confirm Your Domain Setup

There are two options here… you are either a.changing the address of your site and keeping it on the same server, or b. changing the address and the server. Changing servers and keeping the address can follow the same steps as option b. At this point, if you already have the hosting and domain setup on another server, you could run their WordPress install and save a bit of time. I prefer this route when changing an address.

4. Move Files

Log into your site via FTP and download all of the files in the root of your site and the three wp folders. This assumes you are moving to an empty folder on your new host.

Now upload all of your files to the new host. If you opted for the one-click install, then you just need to upload the contents of the wp-content folder and none others. Take care not to overwrite the new wp-config.php file int he root of the new site location. That has your new DB details in it.

5. Import DB

If you don’t already have a database ready, now you’ll want to use your hosts tools to create a new mysql db. Note the database server address (often just ‘localhost’), db name, username, and password. If you used a one-click install, then download the new wp-config.php file for those details. After install, find your host’s link to open up PHPMyAdmin. If you haven’t used this before, it’s a fun chance to explore how the database of WordPress is setup. It’s pretty logical and labeled well. The only time I jump directly into the db is when I need to hijack an admin account by manually changing the email address on it. (That power tip was for free… 😉

Navigate to the new db and select ‘import’ from the top of the screen. Your’ll navigate to the file you downloaded earlier and if all goes well, you’ll get a confirmation on screen about how many thousands of queries you just ran. That’s good.

You will likely need to confirm that the wp-config.php file identifies the correct db prefix. You can actually have multiple installs on the same db if you are using different prefixes. I don’t recommend it, but it’s interesting.

 

Well, if you did everything correctly, you should be up and running! Don’t forget to bug the heck out of your host’s customer service if you get stuck. That’s why I use hosts that have phone support. In case you need a quick recommendation for affordable hosting, check out Bluehost.

 

Scott Bothel

About Scott Bothel

I'm a digital marketing consultant living and working in the Greater Seattle area. My passion is to help small businesses leverage web marketing to accomplish great things!