Skip Navigation
0

The WordPress Codex is a great resource of information but can be a bit overwhelming for some users looking to migrate to a new hosting provider or change domain names.

We created a printable checklist to help with migration. We also covered the issue of SEO and what to do in case things go wrong.

Get the Checklist

 

Before You Begin

Please remember to retain an original backup saved in a safe place separate from the actual files you will be working with. Name your file something like: yourfiles_backup.zip. Include site files and database. This should remain untouched and only used if restore methods fail. We will explain back up methods later.

Do not turn off the account for the old hosting provider yet. Leave it active for at least a week in order to give DNS time to resolve and for you to verify files and database.

You should have already prepped other items such as moving email accounts and setting up an account at the new hosting provider and/or decisions about the new domain name with nameserver settings, if applicable. Note: some back up methods explained in this article will also back up your email accounts.

 

Moving the Files & Database

These options can be mixed and matched to fit your needs.

Ask Your New Host

First, ask your new web host if they provide services to move from your old host. Most provide this service at no cost depending on the server set up.

Using a Plugin: Duplicator

Duplicator allows you to backup and reinstall the database and WordPress files either for safe keeping or to a new hosting provider. It’s a free plugin with the ability to upgrade to pro for larger websites.

The Easy Way: CPanel

Cpanel has built in features for backing up databases and files. It’s even easier if migrating from Cpanel host to another Cpanel host.

Option 1: Cpanel to Another Control Panel

  1. Login to Cpanel and locate “Backup Wizard”.
  2. Select the backup option.
  3. From there you can select “Home Directory” and “MySQL Databases”.

Option 2: Cpanel + File Manager + PHPMyAdmin

  1. Locate “File Manager” and click the “Document Root” option.
  2. Right click on the public_html or www folder and press “Compress”. Note the file name.
  3. When complete, browse to yourwebsite.com/filename.zip
  4. Go back to the main Cpanel. Find & click “PHPMyAdmin”.
  5. Click on the main database name.
  6. Click the “Export” tab.
  7. Scroll down and click the “Save as File” option and choose the ‘zipped’ compression.
  8. Click “Go”.

Option 3: Cpanel to Cpanel

  1. For this option you will need to have Web Host Manager (WHM) part of your account. This is normally for resellers or dedicated servers. Login to WHM.
  2. Select “Copy multiple accounts/packages from another server”. This option will copy your database, email and all files.

The Manual Way: FTP

File transfer through FTP is the slowest but sometimes the above options don’t work out. Two popular FTP programs are FileZilla and CuteFTP among others. You will only need to worry about files within the /www/  or /public_html/ folder.

 

Changing the Domain Name

Follow this option when changing URLs or moving from a sub-directory to the root or vice versa.  The permalinks will need to be resaved.

Using a Plugin: Go Live Update URLs

Go Live Update URLs is a simple find/replace plugin to change the URL in the database.

Find and replace the full URL with http and without the ending foward slash “/”:

http://example.com

The Easy Way: wp-config.php

Note: this option won’t work for mulitsites.

Go to Settings > General and change the URL in WordPress Address (URL) and Site Address (URL). Save changes.

In wp-config.php, add the following lines at the top:

define(‘WP_HOME’,’http://example.com’);

define(‘WP_SITEURL’,’http://example.com’);

The Manual Way: Database

If all else fails, you can make the replacement in the database.

  1. Go to “wp_options”.
  2. Find and change the option_value for option_name: siteurl
  3. Find and change the option_value for option_name: home

It should be the full URL with http and without the ending foward slash “/”.

Another way is to update functions.php with:

update_option(‘siteurl’,’http://example.com’);

update_option(‘home’,’http://example.com’);

 

If Something Goes Wrong

Here are some typical scenarios that may surface while transitioning files or domain names:

I accidentally changed the nameservers on my domain before files were downloaded.
Connect to the server’s IP address or temporarily change the nameservers back. The IP address can be located in the email the hosting company initially sent or you can send an email to tech support. You can either connect via FTP to the IP address or if using Cpanel, visit http://[IP-HERE]/cpanel. So for instance, if I was connecting to IP 127.0.0.1 then the URL to get to Cpanel would be http://127.0.0.1/cpanel. From there just login with the same credentials.

Pages return a 404.
Check the URL was successfully replaced in the database. Resave permalinks in WordPress backend.

Homepage menu link returns a 404.
Go to Appearance > Menus and see if the home link needs to be changed.

Can’t write or add images to the uploads folder.
Change permissions to the wp-content/uploads folder to 755. If that doesn’t work, try 777. And if those permissions don’t work contact your new hosting provider.

If all else fails.
Make a copy of the yourfiles_backup.zip backup and unzip the files. Restore the files & database and re-follow steps above. Pay special attention to the URL change and make sure all files and database information have successfully imported.

 

Addressing SEO Issues

Now that you’ve successfully changed hosting providers and domain names it’s time to address any potential SEO issues. You only need to take these steps if you changed domain names or moved from a sub-directory. You should make sure DNS has resolved first and the new site is up and running.

301 Redirects

While your old domain is still active, you can forward the old domain to the new domain by setting up a 301 permanent redirect to the new URL. Add the following to .htaccess for the old domain. Replace newwebsite.com with your new URL:

Redirect 301 / http://www.newwebsite.com/

If moving from a sub-directory it would be:

Redirect 301 /subdirectory/ http://www.newwebsite.com/

You can test if these changes took place by visiting the domain name in a new browser after saving .htaccess.

Further reading: How do I redirect my site using a .htaccess file?

Notify Google & Bing

Next, notify Google and Bing Webmaster Tools of the domain name change.

Resubmit Sitemaps

Notify Google and Bing of sitemap changes.

Notify Users

Alert site users via a newsletter and social media of the new domain name.

Monitor Dead Links & 404 Errors

Keep an eye on any dead links via a 404 plugin. For single pages, you can use a 301 redirect plugin and you can create a custom 404 page.

 

Get the Checklist

 

Documentation & Resources

 

Stay in Touch

You can get blog updates in 3 ways:

Follow WPML on Twitter, like on Facebook or get updates via RSS.

If you have feedback about this article or have ideas for future topics contact me via Twitter or leave your thoughts & feedback in the comments below.

 

About the Author

Tia is a blogger for WPML and Toolset with a background in WordPress and PHP development. Read More. You can connect with her on Twitter.

How can we make WPML better for you?

Share your thoughts and comments about our plugin, documentation, or videos by booking a Zoom call with Agnes, our Client Advocate. Your feedback matters and helps us improve.

Book a call with Agnes