Moving a WordPress Website

Section 1

Overview

WordPress is by far the most popular Content Management System (CMS). It makes creating and especially managing a website’s content very easy with an easy-to-use Graphical User Interface (GUI).

In a previous guide we covered the same process for a regular website (Moving to a New Hosting Service). However WordPress websites like all CMS managed sites uses a database, adding a layer of complexity to the process of moving from one hosting service to another.

Choose the Best Web Hosting Service for Your Site

WordPress Website Migration Service

Many Web hosting providers have a WordPress Website Migration service. This means that the web hosting service takes care of moving your website for you. Some hosting services offer this service as a complimentary service, while others charge a fee. Check to see if the hosting services you’re considering offer this service.

Choosing a new Web Hosting Provider

There are some special considerations when choosing a web hosting service provider for a WordPress website. This WordPress Hosting Guide can help you make an informed decision.

Section 2

Moving your WordPress Website

If you decide to move your WordPress yourself or hire a someone to do it for you, there are plugins that make the process much easier. However, these plugins don’t completely automate the process: you still need to understand the process of manually moving your WordPress website. We’ll reference two of the most popular WordPress website migration plugins after we’ve summarized the manual process.

Step 1 - Copy your WordPress files

If your current hosting service has cPanel, the easiest way to download your website files is to use the File Manager. If you aren’t using cPanel, you’ll want to use File Transfer Protocol (FTP), which we’ll cover next. First, here’s how to download your website files using cPanel’s file manager:

  1. Go to the File Manager and find the files for your website located in public_html or a similar directory. The files and directories will typically have wp appended to them: wp-admin, wp-content, etc.
  2. Click Select All at the top of the list of filesscreenshot: download your website files using cPanel’s file manager
  3. Click on the compress button over on the left-hand side of this window just above the current directory name (e.g., public_html)
  4. A compress popup box will summarize the files to be compressed. You can scroll to the bottom of this to change the name of the file to something like my_wp_website.zip
  5. Click compress to compress the files.
  6. Close the compress popup window.
  7. Select the zip file you compressed, then click download at the top of the window.

You now have all the web files compressed and saved on your local computer. This is important because you now have a backup copy of your website on your local computer just in case. In addition, you can copy these same website files from your local computer to your new web hosting provider.

If your new web hosting account has cPanel, you can use the file manager to upload and “uncompress” the zip file of your website files (if you would like to read more on cPanel and other web panels, you can do so in this comprehensive guide to web panels).

  1. Open cPanel in your new hosting account.
  2. Go to the File Manager.
  3. Locate the root directory for your website in the new hosting service (public_html or something similar)
  4. Upload the zip file to public_html or whatever directory your new host’s documentation specifies.
  5. Select the zip file and click the Extract button in the upper right-hand corner of the screen

You now should see all of your website files and directories listed.

Using a File Transfer Protocol (FTP) client

If your old or new hosting service doesn’t offer cPanel, you can use an FTP client such as Filezilla.

The process is very similar with FTP as it is for the file manager. You’ll first copy your website files to your local computer to have a backup copy, then you’ll copy your website files into your new web hosting account’s public_html directory. Check your new host’s documentation because the directory name may be different.

Consult your current web hosting provider’s documentation for how to FTP the website files from your current host to your local computer, and check your new hosting provider’s documentation for specifics on how to FTP your files from your local computer to your new hosting account.

Step 2 - Export your WordPress Database

WordPress, like all CMS’s, relies on a database for managing content. You’ll need to backup your WordPress database from your old hosting account to your local computer, then import it into a new database in your new hosting account.

  1. Log into to your web hosting control panel and look for phpMyAdmin.
  2. Open phpMyAdmin
  3. Select your WordPress database from the sidebar on the left side of phpMyAdmin
  4. Click the Export tab
  5. Select Quick Export and select SQL as the format
  6. Click Go to start the export process.screenshot: Export your WordPress Database in phpMyAdmin

Once you’ve completed the export, you should have a copy of your database saved on your local computer.

Step 3 - Create a new database in your new hosting account

Next, you’ll need to create a MySQL database into which you’ll import the database that you exported from your old hosting account. You’re also going to create a WordPress database user. This WordPress database user isn’t an account that you’ll directly use yourself, it’s the database user that the WordPress application uses.

It’s important to make note of the database name, database username, and database password as you’ll need them later to set up your WordPress website.

  1. Log into your new hosting account and go to the web hosting control panel.
  2. Open MySQL
  3. create a new database
  4. Create new database user
  5. Create a secure database password. Use the password generator as you won’t need to memorize this password so make it as secure as possible.
  6. Add the database user account to the database you created
  7. Give the database user all privileges.  screenshot: create a new database in your new hosting account with MySQL

Make note of the name of the database, the database user, and the database password as you’ll need them for the next step.

Step 4 - Edit your wp-config.php file

The wp-config.php file is the configuration file that provides WordPress with the database credentials. The database name, database username, and database password will be different on your new host, so you’ll need to edit this file to reflect the settings for your new hosting account.

Open wp-config.php file from your old web hosting account in a text editor and save a backup copy with a different name on your local computer. If something goes wrong, you can revert to the backup copy.

Then change the following lines in your wp-config.php:

Find and change the database name, database username, and database password to reflect the credentials you established when you created the new database in your new hosting account.

code screenshot: Edit your wp-config

If you’re editing your wp-config.php directly in your file manager then just save the file. If you are editing the wp-config.php on your local computer, then save the file and then FTP the file into the root directory of your new hosting account or upload it using the File Manager.

Regardless, make a backup copy of your wp-config.php before you edit it and save that back up to your local computer that you can revert back to just in case.

Step 5 - Import your old database into your new database

The database you created in your new hosting account should be empty. You’ll populate your new database with data by importing the database you were using in your old hosting account.

  1. Open phpMyAdmin in your new hosting account.
  2. Select your new database.
  3. When you’ve successfully opened your database, click the Import tab.
  4. Click on Select File.
  5. choose the database file you exported from your old host, and uncheck the checkbox labeled Partial Import.
  6. Click Go to import your database.

Step 6 - Transfer your WordPress files to your new hosting account

Once the database import’s completed, you’re now ready to transfer all your WordPress files into your new hosting account.

Connect to your new hosting account with your FTP client. If this is the primary or only website in the account, you’ll upload these files right into the root of the public_html directory. Note that different hosting providers may use different directory names other than public_html so refer to your new host’s documentation for details.

If the website you’re uploading isn’t the primary website in the account, find the root directory for the domain name in question (usually the directory will have the same name as the domain name).

Upload all your WordPress files, including the edited wp-config.php file.

Step 7 - Test your Website before changing the DNS settings

You’ll be able to access your website using an IP address or URL your hosting service provides before you point your domain name at the new website. Check with your new host for instructions on what URL to use to access your website before you transfer your domain name. To learn more about DNS and DNS setting, read our guide on managing DNS for hosting.

Step 8 - Change your DNS

Once you’ve determined that everything’s working well at the new hosting service, it’s time to make your website work with your domain name.

Because web hosting and domain name registration services are distinct services, you do not need to change your domain name registrar when you switch to a new web hosting service provider. While it’s convenient to manage the name servers and pay for domain name renewal through the same service, it is not a requirement.

Option 1 - change the name servers to point at a new host.

If you’re happy with your registrar, you can keep your domain name registration there, changing the nameservers to point at the new hosting service.

Once you make the change, you’ll do all your domain name management in the new hosting service DNS manager. However, you’ll still need to use your registrar to manage the renewal of your domain name and to change your name servers again if you change hosts in the future.

In your hosting control panel, you’ll see an option to change the name servers. Reference your new host’s documentation for the specific name servers to use:screenshot: Change nameserver in web panel

Choose a day and time to make this final change when your website and email are likely to see the least amount of traffic and usage. That way, if there is any time lag from the time you change the name servers until your website is live at the new hosting service provider.

It's often best to make DNS changes at a time of day when the website's likely to get lower traffic, which frequently means it's best to make DNS changes at night or on the weekend.

Changes to DNS records can take effect within ½ hour but sometimes take from 12 to 24 hours for the DNS change to fully propagate around the Internet.

Test your website when the changes first take effect and then again in a day or two to make sure everything’s working.

Avoid making any new edits to the website at the new host for a couple of days while you ensure that the website’s working at the new host.

Option 2 - Transfer your domain name registration to your new hosting service

If your new web hosting service is also a domain name registrar, you can transfer your domain name registration to your new host. You’ll need to first “free” your domain from your current registrar, and then you’ll need to complete the transfer from your new hosting account.

In the control panel of your domain name registrar:

  • Obtain a domain name transfer authorization (called an EPP code)
  • Unlock the domain name
  • disable privacy protection
  • Make sure you receive email sent to the administrative contact for the domain name

At your new registrar (hosting service)

  • Initiate the domain name transfer
  • Enter the domain name transfer authorization code (EPP code) when prompted
  • Complete the domain name transfer

screenshot: entering domain to transfer in new registrar

 Once you’ve completed the domain name transfer, it usually takes effect within a couple of hours, but consult your web host’s documentation for guidelines, as it can take days for the process to complete.

You can avoid downtime by keeping your website live at both your old and new host until you’ve confirmed your website works with your domain name at your new host.

Step 9 - Test your website with your domain name

Once you've changed the DNS, do a whois lookup to confirm that the name server or domain name transfer have been successfully updated the whois database (the database of all domain names).

Once the DNS changes have taken effect, test your website thoroughly, asking someone in another location to visit the website, as well as that, will give you more confirmation that the changes you made are propagating across the Internet.

It’s best to keep the website live on both the old and the new web hosting service until you’ve confirmed the everything is working with your domain at the new host.

Step 10 - cancel your old web hosting account

Once you’re confident everything’s working as expected, including your website and email (if applicable), then cancel your old web hosting service.

However, if you’re still maintaining your domain registration at your old host, you'll have to keep a domain registration account open on your old host.

Section 3

Moving your website with a plugin

You’ll find documentation and tutorials for each plugin at each plugin’s website. Though these plugins will automate most of the process of migrating your Website, it’s still  important to understand the manual migration process in order to understand what’s happening at each step.

Note: These plugins help you move your website but you’ll still need to make DNS changes and, if applicable, migrate your email.

All in One WP plugin

The All-in-One WP Migration  plugin helps you move you website, plugins, media files, and themes. This plugin has comprehensive documentation  and tutorials as well as list of supported hosting providers.screenshot of All in One WP plugin

The Duplicator WordPress Migration plugin

The Duplicator enables you to bundle your website files and database into a package, along with an installer.

You can then download the package and the installer, running them on your new host to install your WordPress website at your new hosting service. The Duplicator’s website has complete documentation and tutorials.screenshot of The Duplicator WordPress Migration plugin

Section 4

Moving Email hosting

In many cases, you’ll be migrating your email hosting to the same service as your web hosting, but in some cases, you’ll host your email on a different host from your website. The process of moving your email hosting will involve the same steps in either case.

Step 1 - Setup your email accounts on the new host

You’ll want to create the same email accounts at the new host so that they’re ready to go once you make the changeover. You’ll also want to re-create any forwarders or aliases that you were using at the old hosting service.

Before you decide to move your email hosting, confirm that the new hosting service supports the protocol that you’re using for email.

Post Office Protocol (POP) - With POP, you download your email from the mail server to your local machine using an email program such as Outlook. IMAP has supplanted POP as the most commonly used email protocol.

Internet Message Access Protocol (IMAP) - With IMAP, you read the email on the server, enabling you to check your email from multiple devices, making IMAP more useful than POP in most cases.

Webmail - Many hosting services enable you to send and receive email through a secure web interface. You can use webmail and IMAP together as both read your email on the server rather than downloading your email.

Simple Mail Transfer Protocol (SMTP) - This is the Internet standard for sending outgoing email.

Step 2 - Configure the email settings in your email programs.

If you check your email using email clients such as Outlook, Apple Mail, iPhone, etc., you’ll want to configure these programs for the new hosting service. Your new hosting services documentation will have the settings for incoming and outgoing email, which you’ll then enter into the settings of your email clients.

code screenshot - Configure the email settings in your email programs.

Step 3 - Transfer your email folders

If you’re using IMAP currently and will use IMAP at the new email service, here’s the process for transferring the mail folders over to the new email host.

  1. Create exact email accounts on the new host as you have on the current host.
  2. Assign the same password to the new accounts as you’re using the current email accounts (you can change the passwords later if you want).
  3. In your email program (such as Outlook, Thunderbird, etc.), create two email accounts with these criteria (account pointing to old host is probably already in place).
  4. Both accounts must use the same email address (exact spelling)  and same password
  5. Both accounts must be set up using IMAP.
  6. The IMAP email settings will be different for each account. Use the IMAP settings for the old host in the current account (the current account likely already exists your email program), and use the IMAP settings for the new account pointing to the new host in the other account.
  7. Open up the inbox for the account that connects to your old server. Drag and drop messages from your current inbox to the inbox on your new server.

The process may take a few minutes to transfer your emails to the new account, but when it’s complete, you should have access to all your emails in the new account.

Copy your email folders using cPanel

If both your current hosting account, and your new hosting account both use cPanel, and you use the IMAP protocol (where email is stored on the server), you can use cPanel to download your email folders then upload them to your new account.

Step 4 - Change the Mail eXchanger (MX) records

If you’re switching email hosts, you’ll want to make sure the Mail eXchanger (MX) records are changed from your current host to your new host’s MX records.

An MX record is the DNS record that enables mail to reach you at your domain name. Each MX record has the hostname (e.g. email.example.com) and a priority number, which tells servers trying to deliver mail to you which mail server to try first. The lower the priority number, the higher the priority.

In the following example, the Mail Transfer Agent (the server that’s trying to deliver mail to you would try mx.example.com first and, if that didn’t work for some reason, it would then try mx2.example.com If that didn’t work, it would retry multiple times to deliver the email. Your new email host’s documentation will list at least one MX record to use.

code screenshot - Change the Mail eXchanger (MX) record

When changing MX records, you’ll look in your DNS manager to change your MX records from the host you’re using now to the new host.

You may want to change the Time to Live (TTL) to a lower number temporarily so that the changes you will propagate around the Internet faster.

You’ll want to go back later after you’ve successfully migrated to the web hosting service to change the TTL back to its original value.

A short TTL is useful when you're actively making DNS edits. When you're not making changes, a short TTL will result in unnecessary DNS lookups, which could slow down your website's performance.

 

Step 5 - Test your email

Once you’ve completed the change to your DNS records, you’ll want to send test emails using an outside account (e.g., a Gmail account) to your email address at your domain name then reply to those test emails.

You’ll want to repeat tests for other email accounts you’ve moved over and make sure that forwarders and aliases are working correctly at the new hosting service as well.

Test the following:

Email accounts (mailboxes) - Send and receive to and from each of the email accounts that you’ve created to make sure they all work as expected.

Email aliases (forwarders) - Send an email to each address that’s supposed to forward to one or more other addresses to make sure aliases are working as expected. Also, if users need to be able to send “From” aliases, you’ll want to make sure the email client or webmail interface is setup with that configuration.

Google Groups - If you’re using Google Groups or something similar, you’ll want to make sure that when someone replies to an email sent to the group that the default “reply-to” is what you’re expecting. Review all the Groups settings to make sure they reflect your privacy requirements and so on.

Section 5

Conclusion

Moving a website from one hosting provider is likely to go smoothly if you spend some time learning how the process works and doing some planning before you start the migration.

You may want to see if your new web hosting provider offers a service where they’ll migrate your website for you. Some hosting providers offer this service free with hosting, while others charge for this service.

If you decide to migrate your website yourself, you may want to consider a plugin such as the WordPress All in One Migration plugin or the Duplicator plugin. Even if you choose a plugin, it’s still important to understand the manual process as the plugins still require a basic understanding of how the process works.

 

Choose the Best Web Hosting Service for Your Site