How to Migrate a Website – Change Hosting & Server

web-site-migrationNeed to migrate a website to a new server as part of a change of hosting provider? Domain / website migration can be a complicated procedure the first time you need to do it, and this guide is aimed at de-mystifying the process…

Primarily focused on how to migrate a WordPress website to a new server, most of the stages are part of relocation of any database-driven site – such as Joomla or Drupal. A static HTML site is generally less complex.

Why You Might Need to Move Your Site

Reasons for relocation are many and varied and can be as simple as discovering a much better deal elsewhere. Sometimes the move is driven by dissatisfaction, or a dispute, with the current hosting provider. Sometimes, the current provider may be unable to provide a specific service you require e.g. SSL Certificate, static IP address, or implementation of specialist software or services.

In some cases, your current supplier might be your website designer who has also provided your domain registration and hosting on a proprietary CMS system. Escaping from a situation like that can be slightly more awkward as that may preclude them giving you access to control panel and FTP. Worse, you might not find another service provider with a compatible system…

Regardless of the reason, its much easier to execute a move now than it was a decade ago, and there’s certainly plenty of hosting options to select from.  Some hosting companies even offer technical support to assist you with your move to their server.

In general, most designers, hosting companies and registrars will respond in a professional manner to your requests for the information required to effect a website move. Doing otherwise places their business at risk, as the national domain registrar enforces compliance with the rules.

If the relocation to a new hosting provider requires transfer of your domain registration to a new registrar, that’s a complication but far from insurmountable. Choose your new provider and use their domain migration tools to initiate a change of registrar.  The old registrar is obliged to cooperate promptly, and will probably send you a verification email to ensure you authorised the change. The process is usually completed with a couple of days.

What You Need To Complete the Migration

Making a move requires three sets of basic information as follows.

Old Hosting Account Details

You will need the current hosting account Control Panel access in order to backup your database and/or your site‘s files. You will also need access to FTP details, required to download the backups and site files.

New Hosting Account Details

You will need a new hosting account established and access details for both the Control Panel and FTP. Control panel access will allow you to create a new database if required, and FTP access is essential to quickly upload your site’s files to the new server. You also need the Domain Name Server details, usually provided with the documentation for you new account.

Domain Registration Account Details

You will need the access details for your account at your Domain Registrar’s website in order to make changes to the Domain Name Server (DNS) records. This is where you specify the location of the new hosting server for your domain.

IP Addresses of Old & New Server

To know when DNS propagation is completed, at some point you may find it useful to know the IP address of the current hosting location. If you are a windows user, enter CMD in the Start / Run box to open a command line interface.

Enter the command: ping + www.yourdomain.com

– that will list the current IP address of your website – take a note of it.

How To get Started on the Migration

Assuming that you now have all of the required User ID and password details, proceed to backing up all aspects of your website. If possible;

  • Do a full site backup from your control panel and save that on your local PC
  • Do a database backup if you are using a CMS – such as WordPress, Joomla or Drupal etc
  • Manually copy ALL site files from /public_html/ or /html_docs/ via FTP to your local PC

Backups are always a comfort and reassurance when you start fiddling… Ensuring you have the files stored locally is important because once you change the DNS server records, you lose access to anything left behind on your old server. Prudence and experience suggests that you cannot have too many backups, but you most certainly can have too few! 🙂

WordPress Site Migration Tools

WordPress users will find that there are several site migration tools available. The one I have been using for the past year or two is BackupBuddy. It’s a premium plugin with reasonable licensing costs – I’ve got the $150 Developer’s License which allows unlimited use, ideal when providing website maintenance across many websites. A Personal Licence is a modest $80 and can be run on two sites – ideal for moving or cloning a site.

The New Location

When it comes to getting set up on the new hosting location, you have at least three options;

  1. Transfer the Full Backup and migration script to the desired location, usually /public_html/ or a subdirectory of it if you want WordPress in its own directory. Wait for the DNS propagation to occur and then run the migration script.
  2. Transfer Full Backup and migration script and set it up on the new hosting location straight away under the correct Domain Name. Set the WordPress & Site Address to the correct domain name.
  3. Transfer Full Backup and migration script and set it up on the new hosting location straight away, using the temporary access URL as the WordPress & Site addresses.

Option 1 is far less complicated and leaves fewer issues (such as broken links, WordPress & Site addresses) to resolve after the migration. It does have the disadvantage of showing a blank or “under construction” Home page until such time as you run the migration script.

Option 2 means that when the site is viewed on the Temporary URL, it is referencing the old site for all style.css files etc. All menu links will point to the correct Domain Name. When DNS propagation occurs, everything should immediately work correctly.

In the scenario where you’ve redesigned the site on a development server AND are migrating it to new hosting for the launch, you should not be surprised to see the Home page deliver a 404 error and display badly. If the old site was not WordPress, remember that the relocated (new) site will be looking for style.css and all pages on the OLD domain, where they are not to be found.

As soon as DNS propagation occurs, everything should work correctly.

Option 3 does allow you to check for broken links, missing images etc, but adds the complication of needing to reset the WordPress and Site addresses, and fix up any residual broken links – e.g. those that are stuck as the temporary IP-based URL instead of the correct domain name. This particular issue can sometimes be messy, and is best resolved with the “Search & Replace” plugin – which in itself requires an additional degree of expertise and confidence! 🙂

In a temporary hosting environment, you are obliged to use a temporary Domain URL until such time as the DNS records are propagated. In that case, once DNS propagation is completed, you will need to edit the WordPress Admin / General  Settings for;

  • WordPress Address (URL)
  • Site Address (URL)

These will need to be changed from the temporary URL – (e.g.  http://125.257.231.123/~newsite/wp-admin/) to the site’s correct domain name. Any residual “temporary” path links need to be fixed then because some hosting companies “expire” the temporary URL, breaking those internal links.

 

BackupBuddy Migration

Backupbuddy offers Backup, Restore and Migrate options and makes a complex process as easy as it could possibly be, in a series of logical steps;

  1. Do a Full Backup the website on its current hosting using BackupBuddy
  2. Download the Full Backup and migration script to your PC
  3. Upload the Full Backup and import script to the new hosting location
  4. Within the Control Panel on the new hosting, create a new MySQL database and database user.
  5. Add the database user to the database with full access permissions
  6. Execute the Migration script

The execution script is also a 6 step process that selects the Backup and unzips it, imports the data into the database, and checks and forces correct paths on all internal links etc.  The final step removes the Full Backup, migration script and temporary files.

BackupBuddy may be able to transfer the files to the new hosting location via FTP, depending on server compatibility and security. In practice, there are fewer issues when FTP is used to first download backup and migration script to your local PC and then upload those to the new location.

Static HTML Site Migration

This is far easier, because you don’t have the complication of database migration to deal with.

The New Location

When it comes to getting set up on the new hosting location, you simply transfer all the sites files and directories to the root directory – usually /public_html/

In a temporary hosting environment, you can open the site under a temporary Domain URL until such time as the DNS records are propagated. Be aware that any absolute links will point to the (correct) domain name, not the temporary IP-based URL.

Once DNS propagation is completed, everything should work as it did in the old hosting location. Static HTML sites are far less complicated and leave few if any issues such as broken links to repair.

When to Change the DNS Records at Your Domain Registrar

You are ready to edit the DNS records at the point when you have;

  • All the required access details for both hosting accounts
  • The new DNS records at hand
  • Full & Database backups plus a copies of all files safely in your possession on a local drive
  • Uploaded the Backup and migration script and are emotionally prepared for the move

Log into your Domain account and locate the option to edit the DNS records. Change the existing records to the new values provided by your new hosting provider and save the settings.

DNS propagation may take up to 72 hours, depending on where you are located in relation to the server. Often, it occurs within an hour or two, and in most situations within 24 hours. There is no notification, and the easiest way to determine if its changed is;

  • Check the site and if the default ‘under construction’ page  or a listing of the Home directory loads then DNS records have directed you to the new location
  • Alternatively, for a static site, using the ping command again will tell you what the current IP address is…

After DNS Propagation

For a WordPress user, you are now ready to run the migration script (importbuddy.php) which unzips all your files and install them and the database for you.

Once the site has been loaded into its new home, check it thoroughly for broken links, missing images etc.

Finishing Touches to Site Migration

If you successfully moved the site and everything is working as it should be, courtesy suggest that a note to your old hosting company is appropriate. Let them know your move has been done and thank them for their help and services.