How to Change Web Hosts
By Brian Shoemaker


So, you have decided to switch web hosts. It is recommended you start the process at least a few days before the time runs out on the account with your present host. This will keep your website from experiencing any downtime between the move.


The first thing to do, after you have searched and found a new web host, is create a backup of your website. Make a new folder somewhere on your computer. Using your favorite FTP program, such as WS_FTP or Cute FTP (these and other FTP programs can be obtained at download.com), download all the files and folders on your website to the new folder you just made on your computer while maintaining the same folder and file structure (this will be important when uploading your files and folders onto your new host's server later). Make a note of any special chmod permissions you have set on any file or folder (look in your FTP program's help documents for information on checking a folder or file's chmod permissions). You will need to reset the permissions after you upload your files and folders to your new web host's server.


If you have any scripts or programs that you made a database for, make a backup of each database. If you have a database other than MySQL, check with your present web host for instructions on backing up your database. If you don't have any databases, you can skip these instructions. If your web host offers phpMyAdmin, log in to your control panel and go to the database section. Look for a link to phpMyAdmin and click on it. If required, log in using the username and password you gave for your database. If you assigned a different username and password for each database, you will have to repeat this process for each database. After you log in, click on "databases" and then click on the database you want to backup/export. Click "Export" on the top menu.


If you are using phpMyAdmin 2.4.0, highlight all the tables under "View dump (schema) of database." Make sure the "Structure and data" radio button is selected. Check "Save as file" and select either "zipped" or "gzipped." Click "Go" and save the file (it would be a good idea to create a new folder in which to save all your databases).


If you are using phpMyAdmin 2.6.0-pl1, highlight all the tables under "Export." Check the "Structure" and "Data" boxes and select "SQL" under the tables you highlighted. Check "Save as file" and under "Compression" select either "zipped" or "gzipped." Click "Go" and save the file. (it would be a good idea to create a new folder in which to save all your databases). If you don't have phpMyAdmin, you can backup your database using mysqldump.


Next, setup your databases.

If you have MySQL databases, log in to your control panel. Go to the database section and create databases. Also, assign usernames and passwords for the databases (if you have a database other than MySQL, check with your new web host for instructions on creating and importing databases). Now, find the link to phpMyAdmin. If required, log in using the usernames and passwords you just created. If you assigned a different username and password for each database, you will have to repeat this process for each database. After logging in, click on "databases" and select a database by clicking on it. From the top menu, click "SQL."


Go to the folder you saved your databases in and select the database that corresponds to the one you have open in phpMyAdmin. Open the file and copy and paste the database in the large text area in phpMyAdmin. Click "Go" under the text area field. You can also use the browse button to find the file on your computer and click "Go" below the browse field. If you don't see any errors, with whichever method you chose, you have just successfully imported the database. If you have more than one database, go back and repeat this process for each one, starting with logging in with your database username and password.


You may need to edit some files before uploading them in the next step, by changing MySQL database name, username and password settings within the files, if any information has changed. If you don't remember which files contain MySQL settings, check the installation instructions for each script/program.


Next, upload the files from the folder in which you saved your website content onto the new web host's server, maintaining the same folder and file structure, using your FTP program. The only difference in structure may be the location of the cgi-bin. Some web hosts have your cgi-bin inside the www or public_html directory and some have it placed outside. If you had any programs or scripts on your website, you may need to edit some files by changing paths within them. If you don't remember which files contain paths that may need to be changed, check the installation instructions for each script/program. Also, change any file or folder permissions as needed (look in your FTP program's help documents for information on changing a folder or file's chmod permissions).


The final step is to point your domain name to your new web host's name servers. This information probably came in an email from your new web host soon after you registered with them. If not, send them an email asking them what the name servers are for your domain. Once you have this information, go to the website where you have your domain name registered. Log in to your account and set the name servers for your domain. Please note that changes to name servers may take as much as a couple of days to take effect. If you still have a few days left on your old account, your website shouldn't experience any downtime. Once the name servers change has taken effect, cancel the account with your old host (this is so you don't get charged for another term). That's it. You have successfully switched web hosts.


About the Author
Brian Shoemaker is the owner of the web hosting directory Find-A-Web-Host.com offering business web hosting.