Migrating WordPress To A Different Host

I recently migrated this WordPress blog (www.paulpang.com) to a new Host. In my case, I was previously hosting the blog on Netfirms but have moved the website to Bluehost. The main reason I decided to migrate to a new host is that Netfirms does not support the installation of Autoresponse Plus and I wanted to install an Autoresponder that does not require me to pay monthly fees.

Here are the steps I took to migrate my WordPress blog to a new host, bearing in mind that the procedures for your web host might be slightly different from Netfirms or Bluehost.

  1. Upgrade Your WordPress Installation
    Upgrade your WordPress installation to the latest version. This is important if you are installing the latest version on your new host using Fantastico.

  2. Backup All Your Files
    Using a FTP program, backup ALL your WordPress files to your PC. I prefer this than backing up only the necessary files as I can then upload all the files without doing a new WordPress installation on the new host. However, if you choose to do a new WordPress installation on the new host, you need to backup at least the wp-content folder, the wp-config.php file and all other personal files you wish to transfer.

  3. Backup Your Database
    Identify the Database Name that your WordPress blog is using. Use phpMyAdmin to back it up on your PC. You can check out how to to do it at http://codex.wordpress.org/Backing_Up_Your_Database.

    In my case, I have to log in to my Control Panel, click on Hosting -> Databases -> MySQL. A list of all my Databases with columns for Database Name, Description, User Name, User Type and a link to phpMyAdmin for each database will be shown. Then click on the Database Name that you want to backup. You will see a number of tabs including Export and Import. Click on the Export tab, check “Structure and Data” and “Save As File” options and click Go. You can then save the database backup as a .sql file on your PC.

  4. Upload Your Database To Your New Host

    Create A New Database

    First you need to create a new database on your new host in order to import your database backup. In the cPanel of your new host, under Databases, click on mySQL Databases. Under Create New Database, type in the name of the database you want to create and click Create Database. The database is created.

    Next you need to assign a New User to the Database. Under mySQL Users, Add A New User, type in a new user name and password and click Create User. The new user is added.

    Next, you need to Add User To Database. Under Add User To Database, select the user and database you have created and click Add. You will be shown a screen to assign the Privileges for the user. I select All Privileges as I will be the Administrator for my blog. Click on Make Changes and the new user is now added to the database. NOTE DOWN THE DATABASE NAME, DATABASE USER AND PASSWORD of your new database.

    Importing your Database
    In your cPanel of your new host, go to Database -> phpMyAdmin. Click on the Databases tab and select the new database that you have created. Next click on the Import tab. Locate the .sql database backup file that you have saved by clicking on the Browse button and click Go. You will get a message telling you that your database has been successfully imported. 

  5. Modify  wp-config.php file
    Open the backup copy of the wp-config.php file with Notepad on your PC and make the following changes:

    <?php// ** MySQL settings ** //define(‘DB_NAME’, ‘yourdatabasename’);    // The name of the database define(‘DB_USER’, ‘yourusername’);     // Your MySQL username define(‘DB_PASSWORD’, ‘yourpassword’); // …and password define

    Replace yourdatabasename, yourusername and yourpassword with the values that you noted in Step 4a above and save the file. This will point WordPress to the new database that you have imported.

  6. Upload WordPress Backup Files
    Using a FTP program, upload ALL the WordPress files that you have previously backed up in Step 2 to your new host including the modified wp-config.php file from Step 5.

  7. Change DNS Settings
    Log in to the cPanel of the old host. Under Domains -> Domain Manager, click on the + sign to expand the details of the domain name that you are changing settings for. Click on the Security tab, then click on UNLOCK to unlock the domain name settings so that you can make changes. Next, click on the DNS tab and change the DNS settings to your new host. In my case, it is  NS1.BLUEHOST.COM and NS2.BLUEHOST.COM. Click on Modify to save your settings. If you are not planning to transfer your domain name registration to your new host, then go back to the Security tab and LOCK it again.

  8. Transfer Domain Name Registration
    If you want to transfer the registration of your domain name to your new host, make sure you keep your domain name UNLOCK in Step 7 above. In Step 7 above, click on the Transfer tab where you will be able to obtain the AUTH INFO CODE (sometimes called the EPP or Authorization Code). Note down this code as it is required for the transfer as it is used to verify that you have access to the existing domain registration.

    Next log in to your cPanel of the new host and go to Domains -> Transfer Domain. Enter the name of the domain you want to transfer and click Continue. Enter the EPP Authorization Code and click Continue. Once you have entered the correct EPP authorization code, an email will be sent to the Administrative contact listed on the WHOIS record for the domain. Copy the Verification Code that is in the email and paste it in the Admin Contact Verification Code field and click Continue.

    In the Transfer Settings page, under Terms of Service, tick “I own this domain and I agree to the Domain Registration Agreement.” And click Add Transfer to Shopping Cart. (If you have not verified you account with Bluehost, you will not be able to proceed to the next Step. See Step 10 below to verify your account)  In Bluehost case, you will have to extend the renewal of your Domain Name Registration by one year. Next choose your payment method and pay for the additional year of registration. You have now completed the transfer of your domain name to your new registrar. In Netfirms case, you will receive an email from them asking me to Approve or Cancel the transfer. If you do nothing, the transfer will proceed after several days. If you want to approve it immediately, go to your cPanel -> Domain Manager -> Transfer tab of your domain name and click Approve.

  9. Assigning An Add-On Domain in BlueHost
    In cPanel, under Domains, click on Addon Domains. Select “Use a domain that is already associated with your account” and select the domain name of the domain you want to add on if it is not already selected. In Step 3, select Addon Domain. In Step 4, specify the Directory you want the Add-on Domain to point to and click Add Domain.
  10. Verification Of Bluehost Account
    Before you can have full access to your hosting account and related promotions and services, ypu need to provide Bluehost with an email of the account holder’s government-issued photo identification (such as a driver’s license or passport). You need to  include your main domain name along with your ID and email it to verification@bluehost.com.

Upgrading WordPress to Version 2.6

I have just upgraded my WordPress sites to the latest WordPress version which is 2.6. The process is fairly simple. Following is a summary of the steps for upgrading. For a more detailed version, please refer to the WordPress Codex site.

  1. The first thing to do is to back up your existing WordPress site in case something goes wrong! Check out my earlier blog on WordPress Database Backup below for details.
  2. Next get the latest WordPress zip file and download it to you computer. Extract the files after downloading it.
  3. Connect to your site using a FTP program.
  4. Delete your old wp-includes and wp-admin directories.
  5. Take care to preserve your old wp-config.php file in the root directory! Do not delete it. This file contains current settings for your existing installation eg database sign-in information. Compare your existing file with the new installation file wp-config-sample.php. Copy your settings (// ** MySQL settings ** //) to the sample file and rename it to wp-config.php. This is the new wp-config.php file you should upload.
  6. Copy the CONTENTS of the new wp-content folder (including the contents of the plugins and themes sub-folders) to the old directories. DO NOT copy the entire folder or sub-folders as this will overwrite all your customizations and added content!
  7. Copy all other WordPress files to your server, overwriting old files in the root directory.
  8. Login to your WordPress admin page at www.your-domain-name.com/wp-admin. You will be asked to login again. If a database upgrade is necessary, WordPress will automatically detect it and you will be asked to upgrade the database. Click on the link provided and follow the instructions and your database will be upgraded to be compatible to the latest version of WordPress.
  9. Clear your cache if you have enabled caching so that your changes will appear to users more immediately.

Your WordPress installation is now successfully upgraded!

WordPress Database Backup

It is strongly recommended that you backup your WordPress database on a regular basis and especially before an upgrade.

There are various means of backing up your WordPress database. You can check out http://codex.wordpress.org/Backing_Up_Your_Database for a list of the various methods of backing up your database.

However, if you are like me and prefer to do it the quick and easy way, I would recommend the WordPress Database Backup Plugin (wp-db-backup.php) by Austin Matzko. You can download it from the WordPress.org website at http://wordpress.org/extend/plugins/wp-db-backup/.

Here are the steps to backup your WordPress database using the plugin:

  1. Download the “wp-db-backup.2.1.5.zip” file to your computer and unzip it.
  2. FTP the “wp-db-backup” folder to your WordPress wp-content/plugins directory.
  3. Login to your WordPress site wp-admin administration dashboard.
  4. Click on Plugins.
  5. Scroll to the WordPress Database Backup plugin and click “Activate”.
  6. Next click on Manage and then Backup.
  7. Select the tables you want to backup. Some of the tables are selected by default.
  8. Select the Backup Options
    What to do with the backup file:
    – Save to server (wp-content/backup …)
    – Download to your computer
    – Email backup to _________________

    Schedule:
    – Never
    – Once Hourly
    – Once Daily
    – Once Weekly

  9. Click Submit

If you select Save to Server or Download to your computer as the Backup Option, you can click the “Backup” button to generate the backup file immediately.

Once you have backup your database, Restoring your database from backup is then possible if something goes wrong.

Installing Self-Hosted Version of WordPress

Although my Netfirms account already has the WordPress application available for installation at the click of a button, I decided to install the self-hosted version of WordPress for several reasons:

  • I wanted more control over the WordPress application. The WordPress application provided by Netfirms is the WordPress MU (Multi-User) version and there are some limitations (though not critical) for the user who may wish to tweak the application.
  • I wanted to have the latest version of WordPress which is Version 2.5.1
  • I wanted to check out how easy it is to install the self-hosted version of WordPress.

This blog is now running on the self-hosted version of WordPress version 2.5.1.

For those of you who would like to try it out, here is how you do it in your Netfirms account. For those using other web hosting providers, the steps should be very similar except for the cPanel settings. Continue reading