How to Move WordPress Blog to a New Host


Read Steps To Move Your WordPress Blog to a New Host.

Basic assumptions

To continue I am going to assume the following:
  • The domain and blog path will remain unchanged.
  • Both servers, the source and the target, are Linux servers with CPanel access, and have the same versions of MySQL and PHP.
  • The version of phpMyAdmin that I am using is 3.4.11.1, so the exact steps I go through may vary slightly if the interface you are working with varies.
  • Your new server I will assume is a “shared” server, requiring an “add-on” domain. If you are installing the blog to the root domain, the procedure will change slightly but it should be obvious what steps to leave out.
  • I will provide general instructions for changing name servers for a domain name, but I will specifically walk through the task using Namecheap.
  • I will attempt to provide general information regarding “file transfer,” but I will walk through the process using FileZilla on a Windows computer.
  • I will provide general steps for editing the WordPress config file but I will be using TextPad for my walk through.

Downtime and domain propagation

Keep in mind that I’m not offering a “no downtime” guarantee. While there are ways to minimize down time, which I reveal at the appropriate time, this approach will move things along very quickly, while still keeping the process very simple.

The biggest time delay involves domain name propagation. This essentially refers to… the amount of a time a particular Internet Service Provider (the way you connect to the Internet) takes to look up new IP Address translation information.

When a web site is viewed by its domain name, an IP Address “lookup” has to take place to determine where the web site resides. An “assumed” IP is used for the most part to save time, but in the rare event a site changes servers, new data has to be gathered.

The bottleneck is often the ISP, but also the TLD of the domain can slow things down. For instance, a .info domain will likely take longer to propogate than a .com will.

An overview of WordPress transfer steps

I will get very specific below for each step in the process but here is an overview for those that just need a less detailed set of instructions.
Domain ownership change

I won’t cover this below but if this transfer is being done after the result of a web site sale, it’s often a good idea to get the domain ownership out of the way first and foremost.

During the domain ownership change, keeping the same domain host will help things get moving along quickly. You can always move the domain to a new host sometime down the road.

A domain push from a GoDaddy account to a GoDaddy account, or Namecheap to Namecheap is free and the process is a lot more straightfoward than when going from “Domain Host A” to “Domain Host B.” Keep in mind though there is a waiting period to transfer a domain away from a domain host after doing an ownership change, so if it’s critical you switch hosts, do it now.

Keep the name servers the same during the “ownership” transfer to keep things smoothe and simple.
  • Export the MySQL database (.sql or .zip file type is fine).
  • Download all files and folders from FTP server.
  • Create an add-on domain on the new host.
  • Create an empty MySQL database.
  • Make note of database name, database user name, database password, and server name.
  • Import MySQL content from step 1.
  • Modify wp-config.php in the root directory of downloaded WordPress files to reflect new database name, database user name, database password, and server name.
  • Upload files via FTP to location created during step 3.
  • Modify name servers of the domain name to reflect the name servers of the new host.
At this point you can test by visiting the site. Also check out individual posts.

Keep in mind that there might be a “propagation delay.” To save face many providers say that the process can 24-48 hours, and while that may be true for .info domains, in general the process could be near instant, or maybe take 5 or 10 minutes to “kick in.” Don’t hold me to that though.

Written Instructions

Exporting the WordPress database
  • First, login to cPanel of your host, then open phpMyAdmin.
  • If you have more than one database, select the database on the left side.
  • From the right site, choose the “Export” option.
  • In general, the default options are fine. In my case I am leaving “Export Method” as ‘Quick’ and “Format” as ‘SQL.’
  • Click “Go,” and the database file will be downloaded to the default “download path” on your computer. For me, that’s the Desktop.
Download files from FTP server
  • Personally I use FileZilla to transfer files to and from the FTP server. The point though is to download all of the WordPress files and folders, regardless of how you do it. The link above is the starting point to get FileZilla downloaded and setup. You will need specific information to gain access to the files on the FTP server, which your host can help you with. In general though, the FTP username and password will be the same as used for cPanel. Also, the server name will likely be ftp.domain.com replacing domain.com with your web site address, of course leaving off the www portion. Also, in general, Logon Type will be set to “Normal”. While I didn’t have you modify the “Protocol” option, I do highly recommend seeking out instructions to use “SFTP” which is Secure FTP.
  • To stay organized, create a new folder on the Desktop, and download all files and folders from the server into it.
Create an add-on domain, and import database
  • Login to cPanel of the new server.
  • In the “Domains” panel, choose “Addon Domains.”
  • Enter the domain name in the top box (without the www).
  • You can use the Password Generator to create a strong password. This won’t be used in general (unless using domain specific FTP accounts), but it can be used as the database password for simplicity.
  • Click “Add Domain” and folders and internal mappings will be created.By default, when logging in by FTP using the CPanel credentials (as opposed to the domain specific FTP credentials) you should see a folder matching the name of the domain.That will be the “root” of the site and where all the files should be uploaded to after modifying the WordPress config file in a later step.
  • Go back to “Home” found in upper left corner.
  • Open “MySQL Databases.”
  • Type a name for the database and click “Create Database.”
  • Make note of the database name next to “Added the Datbase.” It may be pre-pended with your CPanel username and an underscore, so be sure to check.
  • Click “Go Back.”
  • Scroll down to the “Add New User” section, and specify a username and password. You can use anything but I try to match the DB name with the username if possible, and use the password created earlier in the “add-on domain” steps, but again it doesn’t matter.
  • Click “Create User.”
  • Make note of username and password and click “Go Back.”
  • Scroll down to the “Add User To Database” section. Choose the “User” just created, then the “Database.” Click “Add.”
  • Select the checkbox that says “All Privileges,” and click “Make Changes.”
  • Go back to “Home” found in upper left corner.
  • Open PHPMyAdmin.
  • Select the newly created database from the left side.
  • Click “Import.”
  • Click “Choose File,” browse to the “exported data” from the previous WordPress install, and Open it, then click “Go.”
It might take a couple minutes to upload the file, depending on the size, but the actual “importing” shouldn’t take more than a couple seconds.

At this stage, we’re looking for a friendly message with a green checkmark saying something like: “Import has been successfully finished.” The message may vary based on the version of phyMyAdmin being used.

Change WP config settings, upload files
  • Locate the WordPress files previously downloaded from the old FTP server. Mine are on my desktop in a newly created folder.
  • We want to modify a file in the root called wp-config.php.While this is a plain text file, it can get garbled in some text editors. I personally use TextPad to open and edit the file to avoid that.If you follow suit, be sure to turn on “Word Wrap” after opening the file. To do that, go to “Configure” and click “Word Wrap.”
  • What we want to do here is locate and modify values for: DB_NAME, DB_USER, and DB_PASSWORD using values that were “made note of” in previous steps.DB_HOST may need to change as well, but in most cases it will stay as “localhost,” unless coming from or going to a host like GoDaddy, or serving the database remotely.
  • Now save and close the WP Config file, and upload all files and folders to the server using FTP.If following along exactly you will have created a new folder and downloaded all the files into it. Only the downloaded files get uploaded, not the newly created folder.When logging into FTP (using cPanel credentials) you may have to open “public_html” but in many cases that may be the default location. You should also see a folder matching the name, or very close to, the domain name of the site that you are working with.Upload all previously downloaded WP files, including the recently updated WordPress Config file, into the domain-mapped folder.
At this stage, all “content” is in place. By content I mean all the core WordPress files, theme files, plugins, customization, images, and the database.

All that’s left to do now is tell the world the new IP Address that the domain name maps to. That sounds like a hefty job but fortunately for us, that only involves editing the Name Servers for the domain name.

Editing Name Servers to complete the WordPress migration
Your domain name may or may not be hosted at the same place your web site is, and that’s fine. I host my domains through Namecheap and my sites at HostGator, but there are countless combinations.

Also, your domain may be the root-attached domain to the hosting account, or, more than likely, will have been setup as an “add-on” domain. If following along, you will already know that answer.

The last step is changing the name servers and waiting out the propagation.

Each domain host will have a different but similar procedure for making these changes, but I’ll walk through how to do it with Namecheap. Call your domain host if you aren’t sure how to do it for your domain.

First, let’s find out what the Name Servers should be changed to:
  • Head back to CPanel of your new host.
  • Scroll down to the bottom left, and look for “Account Information,” and 2 or more “Name Servers” should be listed. Grab at least 2.

How do you know if your domain has propagated?

Of course, after a successful, as well as an incomplete WordPress migration and propagation, visiting the blog will probably look exactly the same, so how do you know if the site is serving from the new location?

Great question. All you need to do is check the IP Address that the domain name translates to and compare it against the IP Address found in the “Account Information” section (where you got the Name Servers) in the CPanel of the new host.

You can then Google “check domain propagation” and find a free tool that you can enter the domain into to find out the IP Address to see if it matches.

Keep in mind though that if it does match, while you can test that all components of site are working (just visit a couple pages), this doesn’t mean “full propagation” is complete.

It just means the DNS server your computer looks at (likely from the ISP) is up to date. Other people in your city, region, country, or around the world might not have the new info yet.

So, give it a few days before the deleting the old WordPress content and hosting account, and then your blog should be fully transferred to the new server for the world to see.

Comments