How do I move my site from one host to another?
This article is based on hosting control panels using cPanel. The general steps would be the same for most of the other control panels. This article assumes for whatever reason you can not use the cPanel backup and restore functions. Expressed simply, this is the harder but effective way to move your site. It also allows you to move from one brand of control panel to another.
Secure your new hosting. Be sure to save the welcome email as it will tell you how to upload files and reach your control panel before you change the name servers. I suggest you copy this information to notepad and save the file in my documents with a name you can recall.
On your local computer click on start run and type cmd into the box. This will open the command window (DOS). Type ping and your domain name. You should receive a response that looks something like:
Reply from 205.234.198.2 bytes=32 time=19ms TTL=53
The only information you need is the IP number which in this example is 205.234.198.2. You will now need to carefully copy that IP number to your notepad file that you created above. Copy and paste doesn't work here so you have to do it the hard way. Label it old host IP number = 205.234.198.2. You may never need but if you do you aren't going to be able to get it later when you do need it. Trust me on this one, you will need it.
Note the final . after the IP#'s is a sentence . and not part of the IP#.
Log in to the new account cPanel and remove the FrontPage extensions if they are installed and you aren't going to use them. Most sites don't use them. Failing to remove them can cause all kinds of problems later. Do the cleanup step if you remove them. This removes the .htaccess file created by the extension installation.
If you want mail for this domain you can create the mailboxes now or later. If you use this domain as your primary email, take the time to set up the mail boxes now.
If this is a simple site that uses no database the process is pretty simple. Create a folder in my documents with the site name. Ftp to the server and download all the files from the server to the folder. Be sure to transfer the entire contents of the public_html folder to your hard drive. Be sure you keep the directory structure intact.
Now you just reverse the process. Connect to the new server via ftp and upload the contents of the folder on your hard drive to the public_html directory on the new server. If there is a placeholder page, usually named index.htm or index.html, delete that before you upload your files.
Now you go to where the domain is registered and change the name servers. It can take up to 48 hours for the changes to make it all through the system. Just because it resolves quickly for you doesn't mean the change has made it all through the system. You can always Ping the domain and see which IP number is returned. When you get the new number you know the DNS has resolved for you. During the 48 hour window depending on how your request is routed you may see site on the old server or the new and it may switch back and forth between the two. This is 100% normal.
Non-database sites should skip to Deleting the old site files section at the bottom of this page.
Sites using databases have a few extra steps.
This is how to do it and not lose any data. You have to take the database out of action until the DNS has fully propagated or else you risk losing some of the content during the propagation.
Most sites using databases are also using PHP so the first thing you want to do is make a temporary page that says the site is offline for moving, maintenance or what ever you want to say. You can do this in Word and just save it as a web page. When you upload it to the old server and the new one you must place it in public_html folder and rename to index.html.
The initial steps are the same as for a simple site. Create a folder in my documents with the site name. Ftp to to the server and download all the files from the server to the folder. Be sure to transfer the entire contents of the public_html folder to your hard drive. Be sure you keep the directory structure intact.
Now is where the tricky part starts. You have to modify the scripts to work on the new server. Most of the scripts that I have installed all have one or two common files that are used to connect to the database. Most just have one. Those one or two files are the only ones you need to change and the only thing you need to change is the database name, username and password.
Why do these files need to be modified? All the cpanel servers are set up to append the account username to the items above to create a unique value. If it was not done that way only one person on the entire server could have a database named links. Database names and user names always take the form username_item. Example username_links.
How do you find that file or files? Hopefully you got the instructions with the zipped copy of the script. If you did not, use notepad2 or other text editor to open up a file or two and see which file is always included at the top. Some common names are conn, config, connection, configure and they may end with php or inc. They may be in sub-directory called includes.
Now that you have this ready to go you go back to the old host and upload the temp page you created above. If you browse to the site the only thing you should see is the temp page. The files are still there and if you typed in domainname.com/index.php the site would load fine and usually work. Other people know that also so now you rename index.php to index.php.old and the site is broken.
Open the cPanel for the old site and export your database. This is called a mysql dump. Large databases may need to be exported in chunks of selected tables to keep the size down. Save the export on your hard drive. I prefer to do this in zipped format for larger mysql dumps.
If you are really brave you can delete the database and all the files now. I suggest you don't do that just yet because you may need to come back and do it again. We will show you how later.
Next you FTP to the new site upload all your files. Create your database, database user and add that user to the database. Using phpmyadmin you import the mysql database dump that you made from your local computer.
It may be possible to test the site and make sure everything is working using the temporary browsing directions included with your welcome package. In most cases it is not possible because of the way scripts are written. If all the site links refer to relative paths, it may work. If it uses the domain name you will wind up at the old site every time you click a link. This is the point where you rename the temporary page to index.html and index.php to index.php.old.
The next step is go where the domain is registered and change the name servers to point to the new hosting account and then wait for the DNS to resolve. When it does you go back and rename index.php.old to index.php and test the site behind the temp page. Sometimes because of the way the scripts are written you will need to rename the temp page before you can test the site; index.html.old or index2.html are two that work If everything works you can rename the index.html page or delete it. If you experience any problems you can hold the site behind the temp page until you can resolve the problems.
Deleting the old site files
I suggest you wait the full 48 hours before you delete the old site to be sure the DNS has fully propagated and the entire world is seeing the new site.
How do you delete the old site? Remember way up there at the top of the page when I told you to write down the IP number of the old site? This is where you need it to get to the old cPanel and delete stuff. You might also have needed it if one of your files got corrupted in the transfer process or database import failed for some reason.
In your browser address bar enter http://xxx.xxx.xxx.xxx/cpanel/ where the xxxs are replaced with the actual IP number. Enter the correct username and password into the box and bingo you can now delete all those old files, the database etcetera from your old account.

