Transferring a Website to a New Server
This page outlines the general procedure I use to transfer websites from one server to another. I only cover Linux servers because that's what I use, but the same principles should apply to any server. I assume that if you're reading this page, you know the basics of how websites work and how they exist on servers (if not, you probably shouldn't be attempting this task).
The procedure varies according to different setups and requirements. I've provided a few different options along the way.
Important: The process of transferring a domain name takes time (up to 48 hours). For this reason it is important to plan the move carefully so that it unfolds smoothly and efficiently.
Step 1: Install the website on the new server
Before you transfer the domain name you should get the site up and running (as much as possible) on the new server. This way you can test it thoroughly and make sure everything is working before taking the plunge. It also means the transfer will be more or less transparent for end users. If you do it carefully, no one will notice the transfer and you won't lose any visitors.
You will obviously need the website files to do this. There are several ways to acquire the files:
- You may already have them on your local hard drive, especially if you are the designer/developer of the site.
- You can ask your web designer for a copy of all the files.
- Some web host management systems (such as cPanel) provide an automated function to copy entire accounts from one server to another. This can be very useful because it also moves additional files such as statistics, MySQL databases, etc.
- You can use a website download tool to download the entire website from the old server. I recommend httptrack. Note that this will only retrieve publicly-accessible files, not scripts or databases.
To set up the site on the new server:
- Set up the new server to be the host for the domain.
- Upload the site to the new server, or copy it directly from the old server.
- Make any changes and update settings to the new site as required. For example, you may need to set chmod permissions, enable password protection, check CGI/PHP versions, etc.
- Setup any related services such as email. Remember that any email aliases and accounts will need to be transferred as well.
Step 2: Test the new site
Now you need to browse to the new website and make sure it's working. Because the domain has not yet been transferred you can't just visit the URL, so you'll need to be a bit tricky. There are two ways I can think of to do this:
- In many Linux server configurations you will be able to browse to the site using a URL such as http://new-server.com/~username/. If the site uses standard HTML pages and avoids root-relative links, this method can work fine for testing. However it has a number of issues and you may find that it doesn't work at all.
- The method I prefer is to set the DNS config on my own desktop computer to point to the new server. This way the domain behaves as if it's already been transferred, so it's pretty much completely reliable as a test.
When you are happy that everything is working on the new server, move to the next step.
Step 3: Shut down the old site
This step is only required if you have any interactive or database-driven content, for example, a forum, chatroom, shopping cart, etc. If this doesn't apply to you, go to step 4.
Remember that once you initiate the domain transfer (in the next step), there will be a delay of up to 48 hours during which end users will see either version of the website. In other words, some people will see it on the old server, some will see it on the new server. This raises the prospect of new data being added to databases on both servers simultaneously.
To prevent your databases becoming out of synch, you need to prevent any new data being added to the old database before you transfer the domain. Simply disable any affected features on the site. For example, most forum software has an option to prevent any new posts being submitted. You might like to post a message on the old site saying something like "We are currently moving servers. Please visit again in a few hours and reload this page if necessary".
Once the old databases have been made read-only, you might want to transfer them again to the new server just to make sure you have the most current version possible. On the new server you would obviously then need to enable anything you have disabled.
Step 4: Transfer the domain
Initiate the domain transfer. These days it usually happens quite quickly but don't forget that some ISPs will be a lot slower to pick up the change. Wait at least 48 hours before deleting the old site.
If you changed your local DNS settings for testing, don't forget to remove the test setting.
Finally, once the domain transfer is complete, test everything again on the new server.