Migrating WordPress (and Multisite!) to a New Server

Migrating WordPress (and Multisite!) to a New Server

If your website has outgrown your basic hosting plan, it’s probably time to upgrade and move to a new, bigger and better server.

The WordPress Codex has a guide to moving WordPress, but it contains so much information that it’s overwhelming and difficult to follow.

Oct 2020: We tested all the best WordPress hosts! Find out how we compare.View Results

Luckily, whether you’re trying to migrate a single site or a Multisite network, moving to a new server follows the same basic process. While it is a little fiddly and it does take some time, when you’re finished you will have more breathing space for your site to grow.

If you follow the steps below, you should be able to make the move error-free – and you may even find it fun. Let’s find out.

Basic Housekeeping

Before you do anything it’s a great idea to backup your entire site. If anything goes wrong, you can quickly restore your site and everything will be back to normal.

There are many ways to make an automatic backup, such as with our Snapshot plugin or manually using FTP.

If you need a bit more direction, you can take a look at the WordPress Codex’s Backup page.

Once you have your extra backup, you’re all set to start the migration.

Download Your Site’s Files

Fire up your favorite FTP program and enter in your site’s FTP details to connect to your server.

If you don’t have an FTP account, it’s easy enough to set one up. If you’re using cPanel, log in and click “FTP Accounts” in the “Files” section. Enter in your desired login information and make sure the directory you select includes the location of your site.

The username, password, directory and quota fields have been filled out to create a new FTP account in cPanel
I have selected an unlimited quota since I know my site isn’t big enough to pass my allotted monthly upload threshold. You can add a specific number of MB if you’re worried about it.

The site I’d like to move is in the root of my files so I have entered public_html under “Directory.” Once you have everything filled out, click the “Create FTP Account” button.

You’ll see your new account listed below the form along with any pre-existing accounts. You can now access your files through FTP.

Your “Host” is your site’s IP address which you can find listed under the “Stats” column on the main cPanel screen. You may need to click the “Expand Stats” link if you don’t see it listed. Enter 21 under “Port” and connect.

If you’re using FileZilla, you’ll see your site’s folders listed on the right. Select the files and folders of your entire site, then drag them over to the left of the screen to a folder on your computer.

This is going to take a while so get comfortable.

If you run into FTP issues and you’re not sure how to solve them, our article 3 Common WordPress FTP Upload Errors and How to Fix Them might help. Otherwise, get in touch with your FTP program’s tech support.

Download Your Database

In cPanel under “Databases,” click the phpMyAdmin button. Select the database from the menu on the left-hand side, then click “Export” at the top of the page.

On phpMyAdmin's "Export" screen, the quick export method is selected with a radio box and the format is automatically set to "SQL."
The quick export method that’s selected by default should be perfectly fine, but if you run into any issues, you may want to select the “Custom” option and change any necessary settings.

The default settings are usually fine so go ahead and click the “Go” button. Save the file to your computer and wait for the file to download. If you have a larger site, this may take a while.

Create a Fresh Install

Now you need to create a database on your new server and edit your site’s wp-config.php file to reflect the changes to your database.

You could do this manually, but the easiest way to do this is by creating a fresh install of WordPress automatically. Most hosts offer one-click WordPress installation.

So go ahead and install a fresh copy of WordPress. Add your desired URL and if you’re using Multisite don’t forget to select that option before you finish the installation.

If you need to change your domain as well, this is the point where you need to follow the instructions in our article Moving Multisite to a New Domain (Without Errors!). When you need to search for your old URL in your database, come back to these steps to finish up here before continuing.

Once your fresh install has completed, download the wp-config.php file using FTP or cPanel’s File Manager and save it to your computer, replacing your old copy.

Don’t forget – if you made any changes to your old wp-config.php file, be sure to edit your new one to add in those changes to avoid errors.

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Upload Your Site

Login to your new server through FTP and select all your site files from your computer and move them to the folder that contains your fresh install. You’ll need to make sure you’ve created an FTP account for your new server as you did for your old one.

A pop up that appears in FileZilla when uploading your site to replace the fresh install. The "Overwrite" radio button is selected under "Action" and the check boxes "Always use this action" and "Apply to current queue only" are checked.
You don’t have to keep the “Apply to current queue only” box checked, but if you leave it unchecked, all your future file uploads will use this setting unless you change it manually in the settings.

You’ll quickly see a pop-up appear if you’re using FileZilla that will let you know you already have a file that exists with the same name. We want to replace the files of the fresh install with the ones for your original site.

Keep the default “Overwrite” option selected and also select the checkboxes for “Always use this action” and “Apply to current queue only.”

The first checkbox will prevent you from having this pop-up appear separately for all the other files to save you time. The second option will delete these settings once your current FTP session has closed to prevent future errors.

Once you have made these selections, click the “OK” button.

It will take a while for your site to upload, but don’t feel you need to be glued to your computer screen the whole time. You can even finish the rest of the steps while you wait.

Drop Your New Database Tables

Login to phpMyAdmin on your new server and select the name of the new database that was created with your fresh install from the menu on the left. The page should populate with tables.

Click the “Check All” box at the bottom and in the dropdown box next to it, select “Drop.”

The "Check All" box is selected in phpMyAdmin and the "Drop" option is being selected in the dropdown box next to it.
Since this is a fresh install, you don’t need to backup everything, but you can if you’d like. Keep in mind if something goes wrong it may be faster to delete the fresh install and make a new one depending on your backup method.

A new page will load asking you if you’d like to drop all the tables. Go ahead and click the “Yes” button.

Upload Your Database

Once that’s done, click the “Import” button at the top of the page.

Your now empty database should still be highlighted from the menu on the left. If it’s not, be sure to click it again or this step won’t work.

Click the “Choose file” button that appears on the page and select your database file you saved on your computer. The other default settings should be fine.

In phpMyAdmin's "Import" tab, the "Choose file" button has been clicked and a database file has been selected and opened.
I have an upload limit of 2.5 GB which is more than enough, but if you have a much smaller limit, your upload will fail. This can be changed in your php.ini file. If you don’t have one, you can create one.

Click the “Go” button at the bottom of the page to complete the upload.

Update Your Nameservers

The only thing left to do is ensure your domain is pointed to your new server. You will need to locate your nameservers which are usually under your account settings and could have been emailed to you when you opened your hosting account.

Each hosting company and domain registrar is a little different so check with yours to find out exactly how to complete this step if you’re not sure.

Once this has been done, it will typically take up to 48 hours for your settings to propagate and for your site to appear from your new server. If you’re not sure if it worked, you can lookup your site through WHOis.net and check to make sure your new nameservers are listed.

Conclusion

These steps should make a daunting task quick and painless. If you would like an easier option still, there are many plugins available that can automatically migrate your site, such as Duplicator and WP Migrate DB.

There’s also Backup Buddy, which can help you migrate your sites with no downtime.

If you need to migrate many single sites into a Multisite, check out our handy guide: Migrating Multiple Blogs into WordPress Multisite. If you just need to move your site from a subdirectory to the root of your server, take a look at our post How to Safely Move Your WordPress Site (Without Losing Anything!).

Were you able to successfully migrate your site? Share your experience in the comments below.

Tags: