During the course of running a website it might become necessary to switch web hosts. If you started a site on an inexpensive shared hosting plan and it ended up getting really popular, you might notice that your site goes down frequently, or is just not moving as fast as it should. Your best bet at this point might be to change WordPress web hosts.
So what exactly needs to move or change when you switch from your old web host to your new host?
- Files: WordPress has standard files in the wp-admin, wp-content, and wp-includes directories, as well as some files in the root directory of your site.
- Database: Every WordPress site has a database that holds all of the site’s settings, post and page content, comments, plugin settings, and theme options.
- Email: If you are using your web host to also host your email you will need to make sure you have a copy of any old/important emails before you change WordPress web hosts.
- DNS Records: This is what tells a web browser which server to look at to find your website when someone enters your site’s URL. Since you will be changing to a new server you will need to update these DNS records so your site on the new server can be discovered. This will be updated wherever you purchased your domain from, either through your web host or some third party domain reseller.
This tutorial will show you a step by step approach to making all of those changes. However you should realize that each web host may have a different set of administration areas, so you may need to reach out to them to find out exactly how to get the information you need from them.
Sign Up For New Web Hosting
Do a bit of research before signing up on a new web hosting account. You should know what your current web host is offering so you can sign up for an account that offers more (or less) of what you need. Is your current site exceeding its bandwidth, RAM, CPU, or disk space? Find out what your current host’s limitations are, and what your actual usage has been.
Next do some research and see what other hosts are offering. Many inexpensive shared hosts will have similar limitations in terms of storage, bandwidth, etc. If you have a limited budget, know what that is ahead of time so you can eliminate the more expensive hosts before you dig in too deep.
If you want your host to also host your email check to see if the plans they offer include email hosting or if they charge extra. Some managed WordPress hosts may not even offer email hosting. I’ll go into email more in the email section below.
Export Database From Current Host
Before you export your database and files from your current web host, you will want to make sure that everything is up to date on your WordPress site. Login to the wp-admin area of your site and be sure to update WordPress to the latest version, including any themes and plugins. Now is also a good time to take a quick look through the themes and plugins that you have installed on your site and remove any you aren’t using.
Next, install a plugin like WP Migrate DB or All-in-One WP Migration. What these plugins will do for you is perform a search and replace on your database for things like your domain name (useful if you are moving the same site to a new domain), and file paths, which may change from one host to another especially if you use different user names.
For example, your site on each host may be located in different directories like /home/YourUsername/YourSiteName/public_html/ or /home/YourSiteName/. In this case you would want to use one of these plugins to search for the old directory structure and replace it with the new structure.
I have used WP Migrate DB on several sites and it works great. Here’s a little demo video to show you how it works.
Once you export your database, save it to your computer. I like to make a folder specifically for the export so I know where everything is.
Export Files From Current Host
On your current web host you will need to export your files. Usually this can be done through an FTP program like FileZilla, or another similar program.
Once everything is up to date, login to your site with an FTP program. Download everything in the root directory of your site and save it on your computer in the same folder where you saved your database earlier.
What you’re looking for is in the screenshot to the right. Sometimes you will have to navigate to a public_html directory, or something similar to find these files – your host can help you find them if you need help. You may not have everything that is listed there like an .htaccess file if your site is using the default permalinks, or is on Nginx. The favicon files might be in your theme files, so those may also not be there. Everything else is standard with a WordPress site so be sure you have each of those files and directories listed. You also might have additional files or directories that are not in that screenshot. If they contain files used in another content management system, videos, or other media that you will need, be sure to copy those as well.
Import Database and Files to New Host
Your new web host should provide you with a way to connect to your site through FTP in the same manner that you connected to your old host.
They also should provide you with a way to create a MySQL database. Often times there is a database wizard tool in the hosting settings that lets you create a new database. When creating a new database, open up the wp-config.php file that you downloaded to your computer from your old site using a text editor like Notepad++, or the standard text editor on your computer – not a word processing program like Microsoft Word!
When you create the new database you will need to copy the following information into your wp-config.php file:
- Database Name
- Database User Name
- Database Password
- Database Hostname (if provided – many hosts use localhost so leaving this as is may be fine)
In your wp-config.php file, you will find a section that looks like this:
Replace the values in between the single quotes with the values for your new database. Some plugins like WP Super Cache may also include directory information in wp-config.php that will need to be updated as well.
You will also want to make note of the DB_CHARSET value. The default value in new WordPress installs is utf8, but yours may be different. Make note of what value you have here because you will need it when we get to import the database.
Be sure to save wp-config.php once you have updated these values.
Now that you have your new database created, you need to import the database you exported from your old host.
On your new web host, find out where to access phpMyAdmin, or a similar database management program and login to the database using the username and password you just created. If your host doesn’t have phpMyAdmin, you might be able to ask them to import the database for you – many hosts have no problem doing this for you.
When you login, you will notice that there are no tables or other data in the database – this is because you haven’t imported anything yet.
At the top of the page, find and click the tab that says “Import”. Here you will find a simple upload form.
Click the “Choose File” button and find the database file you exported from your old site. If you noted the DB_CHARSET value in your wp-config.php file, be sure to select the correct character set from the pull down menu. Once you are finished, click the Go button on the bottom right side of the screen.
Your import may take a little while depending on the size of your database. If your database is too large to import through phpMyAdmin you may get errors on the import. In this case ask your host for assistance as they usually have tools that can import much faster.
Now that your database is uploaded, you should upload the rest of your site’s files to your new host.
Connect to your new host through FTP, and upload the files you downloaded to your computer to your new hosting account.
The easiest way I have found to transfer emails from one host to another is to download existing emails from your old host using a mail program like Outlook, Thunderbird, Mac Mail, or any number of other email programs.
Once your new hosting account is set up you can create a new email account with the same email address. After the DNS changes (we’ll cover that below), you can use the mail program to copy the emails from the old account into the new account.
Another method is to sign up for an email hosting provider like Zoho, FastMail, or Google Apps. Some offer limited free accounts for a handful of email addresses, which may not be a bad option if you only have a few addresses. Even better, some of these email hosting providers offer email migration service so you don’t have to mess around with saving emails to your computer.
Whichever method you choose, be sure to have a copy of your old emails stored somewhere before you make any DNS changes or you may not be able to recover any important emails.
The next and final step is to point your DNS records to your new host.
One of the problems with DNS/nameserver updates is that it can take a long time. Sometimes up to 72 hours. Usually it isn’t that long, but it is possible.
A little cheat to speed up the DNS changes is to sign your site up with a service like Cloudflare that has an automatic TTL (time to live) option and free accounts. This means any changes to your site’s DNS records come up in real time as opposed to waiting for propagation to take place.
If you set up your site on Cloudflare at least a few days before you intend on changing WordPress web hosts, you will be able to see if the transfer was successful in real time.
Change Nameservers (Easy but Slower Option)
If you are confused by all the DNS talk going on, don’t worry there’s an easier option.
Your new host will provide you with nameservers that you should point your domain to. Usually this looks something like ns1.yourhost.com, ns2.yourhost.com, etc. All you need to do with this is log in to wherever you bought your domain from and copy it into the nameserver section. Different domain registrars have different processes for accomplishing this, so I won’t get into the details.
I mentioned that this is the slower option, and it is. This method may take up to 72 hours before traffic to your site starts getting directed to the new host. Since it can take a long time, it is important to keep your old hosting account active until you are sure that all traffic is being sent to the new host. To check on the progress of your domain’s propagation, you can use a site like WhatsMyDNS.net. Just enter your domain name in the box and search. When you see all the locations pop up with the new name server, you will know everything has fully propagated.
Use Cloudflare to Update DNS (More Difficult but Faster Option)
In order for this to work faster, you will have to set up your existing site on Cloudflare a few days before you want to change WordPress web hosts. This is because you will still need to change the name servers using the steps provided above. The benefit is that you will be able to check to see that everything transferred correctly in real time, and can quickly switch back if there is a problem.
When you sign up on Cloudflare, they will scan your current DNS records and pre-populate them for you. Usually they are accurate, but double check just in case they missed something. They will provide you with name server records that need updating just like in the previous section. This will take anywhere up to 72 hours to complete, so give yourself some time.
When you are ready to start sending traffic to your new web host, check to see what the values for the DNS records are at your new host. Some hosts list the DNS records for a domain in their admin areas, but you may need to ask for assistance. Often times there are a combination of A, CNAME, TXT, MX records, as well as others that need to be updated. Each host will have unique values that need updating so check with them to find out what to use.
Before making any changes to the DNS records in Cloudflare, take a screenshot or copy the current records. This way you can revert back to your old host if it turns out that something went wrong with the migration.
Once you have entered all the necessary DNS records, you should be able to visit your site and see that the changes came through successfully. If they didn’t you can use the old host’s DNS records to point your domain back to the old server until you figure out what went wrong.
That should be everything you need to do to change WordPress web hosts.
Have you had to change WordPress web hosts? Did you run into any problems along the way or was it a smooth transition?Note: Some of the links included in this article are affiliate links. I will earn a commission if you click on the link to make a purchase, at no extra cost to you. These affiliate links are a part of how this site can stay online. Your support is appreciated!