There comes a time when you decide to switch web hosts. The primary reason is that either the web host is slow, buggy, costly, or has limited features for your website. You might also decide to transfer to another web host located in your targeted country to get the benefits of geo-targeting in Google (see my on geo-targeting and SEO for more information).
The examples used in this tutorial are for websites requiring a LAMPP environment (Linux, Apache, MySQL and PHP), though the concept of transferring processes can be applied to any hosting server configuration.
Step 1.) Download All Important Files in your Existing Server
The first thing that you should do is to download all important files in your existing server. These files are the following:
a.) Template files (e.g. those with .php, .aspx, .asp, jsp) needed for normal operation of your website.
c.) .htaccess files or web.config
e.) important documents.
If you do normal cleaning in your hosting server, then all of the files in it are important, so you will want to download all of them. Using an SSH (recommended for better security) or FTP client, you need to select all files (press Control-A) right click on them, and start downloading.
Step 2.) Download All Important Databases
If you have a dynamic website (a website that uses databases such as MySQL, MS-SQL, etc); then you also need to download it to your local computer. Since most websites use MySQL databases in Apache/Linux/PHP web environment; let’s use phpMyAdmin to download it:
1.) Log-in to your hosting control panel and then go to the phpMyAdmin interface.
2.) In one of the phpMyAdmin menus, click “Export” link.
3.) Under “Export”, you will see the list of your MySQL database. If you have more than one MySQL database, it is recommended that you download them one by one. Select one database first, and then make sure “SQL” is selected. Leave the rest of the settings as default.
4.) Ensure the “Save as file” is checked. Then click “Go” to download the database.
You can find the correct settings used to download MySQL database here using phpMyAdmin: http://www.php-developer.org/screenshot/downloadingdatabase.jpg
5.) Once downloaded, the file name of the SQL file will be changed, for example it will named something like localhost.sql. This is ok.
6.) If you need to download another MySQL database, repeat procedure 2 to 5 above.
Step 3.) Test your Backup Files and MySQL database in Local host
This step is optional but highly recommended if you need to ensure that you have correctly downloaded all files and the required databases. Sometimes, when you are downloading files, you might forget to download important files such as images, etc in some parts of your server. As a result if you do not check your backups, your website will not work properly in the new web host. Below are the recommended steps to test your backups:
1.) Install XAMPP to your computer. This is a local Apache web server with MySQL and PHP which act as a local web host in testing your backups.
2.) Transfer all your files to the htdocs directory. If you are using CMS such as WordPress or Joomla, you need to install it first then transfer your theme files to it. For WordPress users, you can read this tutorial: http://www.aspfree.com/c/a/BrainDump/Install-and-Run-WordPress-in-XAMPP-Local-Host/
3.) Import your MySQL database to XAMPP phpMyAdmin. To import the database:
a.) Login to XAMPP phpmyadmin: http://localhost/phpmyadmin
b.) Click “Import” link.
c.) Under “File to Import” locate the downloaded MySQL database in Step2.
d.) Leave the rest of settings unchanged. For reference, this setting seems to work well for database import: http://www.php-developer.org/screenshot/databaseimport.jpg
4.) Check your website in the browser by running it locally, e.g. http://localhost/mywebsite/ . Check for:
a.) Missing images.
b.) Distorted pages
c.) Functionality/missing features
Make sure that your website appears as complete as possible. If something is wrong, some files might not be downloaded properly in Step1. Compare the files you have downloaded with the one in your existing remote server.
Step 4.) Purchase a new web hosting account
Make sure that your new web host has all the features you need as well as using the optimized Apache/MySQL and PHP versions, etc. Do not be afraid to contact web hosting support to make sure you are purchasing the right hosting features.
It would be nice to prepare a list of questions that you need to ask to the new hosting company before making any purchase to avoid any delays due to some mistake in choosing web hosting packages. Read a lot of reviews on the Internet about that new web hosting company to ensure that it provides excellent service and it won’t end up the same just like your previous web host.
Step5.) Upload your Website Files and Database to New Web Hosting
IMPORTANT: DO NOT DO ANY DNS TRANSFER YET AT THIS STAGE. Instead do the following:
1.) Login to your new FTP/SSH server provided by your new web host.
2.) Find the root directory of your website. Mostly this is found inside public_html or www folder.
3.) If you locate it, try uploading a test HTML file (named it as “test.htm”) containing text content like: “Hi, this is just a test”. Upload this file to the root directory of your new hosting server. The purpose of this test is to locate the correct root directory.
4.) Your hosting company provides an IP address of your new hosting server after purchase. Make sure you have this IP address.
5.) Access the uploaded test HTML file using a web browser, e.g.:
69.456.343.222 is the IP address of your new hosting server (provided by the hosting company). If you can see the text “Hi, this is just a test” outputted by the browser, then you have located the root directory. Otherwise if this is not working, contact your web hosting support where to temporarily upload files for testing before doing any DNS transfer.
6.) Upload the tested backup files in Step 3 and install any CMS software needed (e.g. WordPress, Joomla).
7.) Import your website MySQL database to your new web host (similar procedure in Step3).
8.) To test your website in your new hosting server properly (before DNS transfer), make sure:
a.) Your website configuration files will be using your website IP address in your new hosting company instead of your domain name. In WordPress, make sure the “siteurl” and “home” field in wp_options table are pointing to IP address (e.g. http://69.456.343.222, not the domain name of your website.
b.) Access your website in the browser using its IP address instead of domain name. For example, if you have this URL in your current hosting:
Then to check if this URL is working in your new hosting server, you will access this using an IP address:
Double check if your website is working properly just like it was in your local host or in the current web hosting.
Step 6.) Change your website DNS settings to point to new web host
IMPORTANT: DO NOT SHUTDOWN OR CLOSE YOUR OLD HOSTING ACCOUNT YET. It’s time to change the DNS/name server settings of your website; follow the steps below:
1.) Change all references in your new hosting configuration from using IP address to your domain name. For details (e.g. if you are using WordPress, Drupal or Joomla), you can read this guide: http://www.php-developer.org/cmsnewhosting.txt . Make sure all links in your newly hosted website should point to the domain name and not to the IP address version of your domain.
2.) Login to your domain registrar (where you have registered your domain). For example, in Network solutions you will click “My Domain Names” then go to “Edit DNS”. Make sure the Name Server 1 and Name Server 2 points to your new web hosting company DNS server (provided by your new web hosting company after purchase). Example:
3.) During this stage, your website will go into the DNS propagation stage which will last up to 48 hours. The good thing is that your website will not experience downtime during this time because you have pre-configured your website to work in your new hosting company.
4.) After 48 hours, ping your website and it should have a new IP address, this IP address is provided by the new hosting company.
Example: ping www.yourwebsite.com in DOS command prompt. Before you ping, you might want to enter: ipconfig /flushdns to clear the DNS cache.
5.) Double check if the website will operate normally in your new hosting after the DNS transfer. Check for broken links, you can use Xenu sleuth to do this. http://home.snafu.de/tilman/xenulink.html.
Step7.) Shutdown/Close your old hosting account
Check for server logs in your old hosting account. If you do not get anymore request or logs, especially traffic coming from search engines or even search engine bots visiting your page. It implies that they are now visiting your website at your new web hosting account.
You can safely close your old hosting account. You might as well keep updated backups of your files and databases then delete all files in the old hosting account.