Moving your WordPress blog

Some time ago, I switched web hosts, which involved transferring WordPress installations of two sites. The steps I followed to move both the database and the WordPress site files are below.

Before beginning the actual step-by-step instructions, you’ll need to establish and pay for a hosting account at your new web host.

The instructions here might differ slightly depending on your new web host and their setup.

What you need to start the process:

  • Ensure your account at your new web host has been established.
  • Review the email the new host sends you, and note the following:
    • The name servers (DNS) for your account
    • Your IP address
    • The address at which you log in to the control panel (c-panel)
    • The address at which your site can be viewed before the DNS propagates
  • If your domain is registered by a provider other than your web host, note the following:
    • The address at which you log in to the control panel of your domain registrar
    • Your login user ID and password
  • From your current, to-be-switched web host, note the following:
    • The file structure of your website(s) (I take a screenshot of the File Manager area)
    • The name(s) of the MySQL database(s) associated with your site(s)
    • The user name and password of the MySQL database associated with your site

Overview: Domain Name Servers

When you transfer web hosts, you must point the domain to where the files for the domain reside. In other words, you have a website (www.yoursite.com). Its name is registered with a company (the registrar) that holds information about who owns the website, and where the files comprising the website are stored. The files comprising the website are stored at your web host. When you change hosts, you must update your information at the domain registrar to point to the new host’s domain name servers (often called “updating the DNS information”).

Once the name servers at the domain registrar are changed, it may take anywhere from 30 minutes to 48 hours (perhaps even longer) for the change to propagate through the internet. The delay is because of the nature of the internet: While the change is made at the domain registrar, thousands of “bookmarks” to your domain are maintained by different web hosts and internet service providers, the gateways of the internet around the globe. The bookmarks receive updated address information for your site when you change your DNS information, but sometimes it takes longer — a day or two — for the change to move throughout all the various gateways.

Knowing how this works is relevant because you’ll want to switch your hosting as seamlessly as possible, with minimal down time — but the exact time the transfer can’t be precise. The easiest way to seamlessly transition the site to the new host is to install and transfer your WordPress files to your new host BEFORE you change the DNS servers. Then, when you change the DNS, the new installation is waiting, no matter how fast or show the servers propagate. The instructions below follow this strategy.

Moving your WordPress files and MySQL database

1. Gather the information noted in “What you need to start the process”, above.

2. Ensure you have the latest version of WordPress installed on the host from which you are moving. Upgrade if necessary.

3. Back up your existing WordPress files and database. Instructions on how to do this are here, at an earlier post.

4. Log in to the control panel at your new host.

5. Create any necessary add-on or subdomains using the icons/buttons in the control panel. (Note: While some hosts may allow you to create subdomains and addon domains by manually creating files in the file manager, I tried this and had problems – it’s best to use the tools rather than go around them).

6. Create any necessary subfolders used to hold your WordPress installation (for instance, if your domain is yourdomain.com, and the WordPress installation you just backed up to move is located in a folder (myfolder), you must recreate the folder in order for your links to work correctly.

7. Install WordPress and the MySQL database, following your host’s instructions (make certain you install WordPress into the appropriate directory/subdirectory). Note the following when you install:

  • WordPress
    Admin user ID:
    Admin password:
    Login site:
  • MySQL Database
    Database name:
    Database admin user ID:
    Database password:

8. Upload your existing WordPress files (the ones you got when you backed up your existing site) from your computer to the new host site using FTP. Overwrite the existing files! (I use the free FTP program FileZilla).

9. Upload your existing database to the new host using phpMyAdmin.

  • Log in to the Control Panel of your new web host
  • Click the phpMyAdmin icon
  • Select the database created and associated with the fresh WordPress install
  • Click the Import link.
    Click the Browse button to select the database backup you made earlier
    Click GO to complete the import
  • Edit the wp-config.phpfile, located under the root of your install folder, using a text editor to ensure WordPress points to the correct database:
    • /** The name of the database for WordPress */
      define(‘WP_CACHE’, true); //Added by WP-Cache Manager
      define(‘DB_NAME’, ‘YOUR DATABASE NAME HERE’);
    • The /** MySQL database username */
      define(‘DB_USER’, ‘YOUR USERNAME HERE’);
    • /** MySQL database password */define(‘DB_PASSWORD’, ‘YOUR PASSWORD HERE’);

At this point, since the domain name servers have not yet been changed, your site at the new host will not be visible through the web. You will need to use the link given to you by the new host (see  “What you need to start the process”) to view your site on the new host. The links from page to page at the new host will not work until the domain name servers point to the new host and have propagated.

After you have moved your WordPress files and database, change the DNS to point to the new host

1. Log in to the domain registrar.

2. Navigate to the area listing the name servers for your domain.

3. Enter the name servers (usually two) of the new host.

4. Save the change, and wait!

While the propagation time can be anywhere from 30 minutes to 48 hours, I would say that most of the sites I’ve changed have taken about two to three hours, or at the most, overnight.When the change of name servers propagates, your site will be visible on the new host’s servers, without any down time!

Note: If you plan on redesigning your WordPress site before the DNS propagates, you’ll have to change several values in the database before you begin, in order to have your links work, and then reset the original values once the DNS propagates. I’ll cover this in another post.

Disclaimer: My web host is HostGator, and after transferring to and being impressed by their services, I became an affiliate. If you click a link or ad to HostGator on this site or my blog, and purchase their services, I receive variable payment. If you want to visit their site and not click any links, type hostgator.com in your browser. I am not receiving any compensation from HostGator for writing these instructions.


Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>