How To Migrate a WordPress Site

How To Migrate a WordPress Site

How To Migrate a WordPress Site

WordPress is a popular Content Management System (CMS) for managing personal blogs, large corporate websites and medium businesses portals. It makes creating and especially managing a website’s content very easy with an easy-to-use Graphical User Interface (GUI).

Sometimes, you may want to move your WordPress site from one web host to another one. However, WordPress websites like all CMS managed sites use a database, adding a layer of complexity to the process of moving from one hosting service to another.

WordPress migration procedure should be straightforward and precise to avoid losing your website data. In this guide, we will show you how you can execute the plan and move your WordPress website from one host to another provider.

The Steps for Moving Your WordPress Site To Another Domain Host

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.

If you decide to move your WordPress yourself or hire 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.

Requirements for migrating a WordPress site include:

  • Domain name
  • Hosting account where you want to migrate your site
  • Access to file manager and database management tools on the old and new host

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 files
  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

  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.

If your old or new hosting service doesn’t offer cPanel, you can use a File Transfer Protocol (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 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.

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.

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.

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 has been 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 – 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.

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:

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.

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. Also 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

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 8 – 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).

After the DNS changes have taken effect, test your website thoroughly. Additionally, asking someone in another location to visit the website 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.

How To Move Your Email To Another Domain Host

In many cases, you’ll be migrating your email hosting to the same service as your new website host, 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. Available protocols may include:

  • 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.
  • 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.

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.

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

An MX record is the DNS record that enables mail to reach you at your domain name. 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.

Each MX record has the hostname (e.g. email.example.com) and a priority number, which tells servers trying to deliver mail the mail server to try first. The lower the priority number, the higher the priority.

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.

Last Words About Moving to a New Host

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. Accordingly, it’s important to understand how exactly the manual process works to ensure a smooth and efficient transition without downtime or misplacing any critical data.

How to Start an Online Store on the WordPress Platform

It’s an era of e-commerce and people always look for a better source to star
5 min read
Angela Olaru
Angela Olaru
Senior Writer & Hosting Expert

How to Edit the CSS for your WordPress Site Using the cPanel Hosting Control Panel

As you know, the design of a WordPress website is controlled by
4 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to use Amazon RDS with your WordPress Installation

The default instance which is set up while creating an EC2 server with complete
3 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Reduce CPU Usage by Limiting WordPress Heartbeat API

It’s always recommended to keep your website optimized because the CPU utili
4 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top