So you probably are not satisfied with your current web hosting company and want to switch to another. If that's the case, one thing that troubles every webmaster is that how am I going to transfer so many files. Many web hosts provide free website transfer services when you are signing up with them. But again, they may agree to transfer only a couple for free and ask for money for others. W need to move websites from one web host to another. In either case, your casual way of doing this task would be:

Traditional Approach - The nightmare

  1. Download files to your computer from old hosting (consumes your bandwidth)
  2. Upload files to new hosting (consumes your bandwidth again)

And it takes a lot of time as well.

While traditional approach can be good for small websites, it's going to be a nightmare for websites having tens of thousands of files.Why not transfer files from old hosting to new hosting directly? Those who are friendly with Linux/Unix based operating systems will say "Dude, haven't you heard about wget, just ssh to your server and call wget to download those files? You can use SSH on your new hosting and use http to download the files" and I say, "Of course my friend. I have. But I don't have wget available with me because I'm using shared Windows hosting" and they don't say anything after that.wget via SSH is undoubtedly an awesome tool. But unfortunately if you are using Windows Hosting and that too shared, there is very little chance of your hosting company providing you access to this tool via SSH or RDC. So to achieve the same flexibility of old host to new host direct downloading, we'll be using a simple yet effective php script.![](http://www.Smarterasp.net/affiliate/728X90.gif)

Before you begin

Before you begin, you need to do following.

  1. Change the nameservers of only one of your domains (*let's just call it **controller domain *for easy reference) to point to your new hosting account. Consult your new hosting company to know about their nameserver details. Note that you should NOT change the nameservers of all the domains at ones. This is because we'd be using http downloads for the purpose of transfer.
  2. Add that domain to your new hosting account. Again consult your hosting company to know about how to do that.
  3. Test if your controller domain now points to your new web host. You can do this by simply typing the controller domain in your favorite web browser. It should show a default hosting page of your new host.
  4. Make sure you have php enabled on your new host.

Move websites from one web host to another quickly

So now that you have done all the necessities, let's get down to business.

Old Web Host

  1. Open your old web host's control panel and find all the websites that you have there.
  2. Create a zip file for each of your domain using your control panel's zip utility. Most web hosting companies provide this tool. Consult your hosting company's support documents to learn about how to do that.
  3. Move all the zip files to one of the domains which is not controller domain (or you may move each zip file to it's individual domain as well). So your files may look like: http://www.domain1.com/domain1.zip http://www.domain2.com/domain2.zip http://www.domain3.com/domain3.zip . . or . . http://www.domain.com/domain1.zip http://www.domain.com/domain2.zip http://www.domain.com/domain3.zip

Irrespective of which way you chose, the thing is that we'll be downloading these zip files from one (or more) of your domains on old host via controller domain on new host

Notepad is your friend

Open notepad (or any editor that's your friend) and paste the following code.

<?php
if(!isset($_GET['url'])){exit(0);
}

$url = $_GET['url'];

$name = basename($url);
set_time_limit(0);

//This is the file where we save the    information
$fp = fopen (dirname(__FILE__) . '/' . $name, 'w+');

//Here is the file we are downloading, replace spaces with %20
$ch = curl_init(str_replace(" ","%20",$url));
curl_setopt($ch, CURLOPT_TIMEOUT, 5000);

// write curl response to file
curl_setopt($ch, CURLOPT_FILE, $fp); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

// get curl response
curl_exec($ch); 
curl_close($ch);

fclose($fp);

echo "Yep...DONE!!! :)";
?>

Save this file as download.php. This file is simply a php script that takes as parameter the URL of the file to download. We use curl to download the file, but you can write your custom downloader as well.

New Web Host

  1. Open the control panel of your new web host and go to the root folder of controller domain.
  2. Using the file upload tool, upload the file we created above to this folder.

Jet Set Go

  1. Now open your web browser and type the following in the address bar:

http://<controllerdomain>/download.php?url=http://www.domain.com/domain1.zip or http://<controllerdomain>/download.php?url=http://www.domain1.com/domain1.zip

depending on where you've stored in your zip files in the steps above. Replace <controllerdomain> placeholder with your controller domain 2. Press enter and wait. Once the download completes, you should see a message

Yep...DONE!!! :)

which literally means what it says :)

In general, call each of your zip file http locations as parameter to download.php

http://<controllerdomain>/download.php?url=<url to zip>

You'll now have all the zip files transferred from your old host to new host and you've saved your bandwidth. Once done, you can now add your other domains to new hosting and change their nameservers. Faster. Plain. Simple. :)

A word of caution

Delete the file download.php as soon as you are done. Needless to say, it's presence can cause some disastrous things if used inappropriately.