If you have never moved your website before, you will probably think that it is a trivial matter. After all, it only involves copying files onto the new server, right?
Actually there's more to it than meets the eye. I have moved one of my other websites, thefreecountry.com, many times in its rather long history, both with changes in the URL (back when it was without a domain name) and when I moved the actual domain ("thefreecountry.com") between web hosts. It seems to me that each time I move, I overlook some important aspect.
I'll deal with both the mundane aspects, that is, the checklist of things you need to do, as well as the more problematic situation of helping you minimise ("minimize" in US English) your loss of visitors.
Note that there are some differences between moving your site when you have your own domain name and moving it when you do not. I'll try to cover both these cases in this article.
Note: if you are here because you only want to point your domain name to a website on a new web host, and not to move an entire website between hosts, please read How to Point a Domain Name to Your Website instead.
The funny thing about websites is that no matter what everyone recommends officially, there continues to be people (more than you think) who actually only maintain only one copy of their website: the one on the web server.
If you're one of those, make sure you make a copy of your website on your computer. This has to be done even BEFORE you inform your old web host that you are terminating. In fact, it may be wise NOT to tell your old host that you're terminating just yet, since some people who run web hosts react badly. They may terminate your account before you're ready, throttle down your bandwidth or other such petty things. It really depends on how professional (and mature) the people running that service are.
To copy your files, just use the method that you normally take to upload your files, and download them instead. If you do it through FTP, then download them using FTP. If you use a browser to access your site via your web hosts' control panel, then do it that way. If your site is a blog, or uses a Content Management System (CMS), and you don't know how to back it up properly, you should probably read How to Back Up a Website, since such sites require you to also back up the software's database.
If you're on a free web host with advertisements (pop-ups, banners or otherwise), you should not simply connect to your site with a browser and save the page you see. Such pop-ups and banners are normally inserted at the server level, modifying your web pages on the fly to add some additional JavaScript code to generate the pop-ups. When you save it the normal way your visitors do, you're also saving the pop-up code the server adds. Of course you can simply edit the file to delete it later, but why give yourself extra work?
The next step is to check all your internal links to make sure you do not have any hardcoded URLs pointing to the old address. This is not a problem if you have your own domain since your web address will not change in that case.
If you don't have your own domain, you might want to consider making all your internal links relative links to simplify your relocation process. You can always hardcode links again later if that's what you prefer.
If your old web host forced you to add some banner code or text link to your pages, this is a good time to delete them.
Note that your old site is still active. At this point, no one knows you're going to shift yet (except of course you and your new host).
Upload your pages to your new host. Test all your pages. Make sure they work. Remember, you have not yet officially shifted. If you have your own domain name, you have also not yet updated your DNS to point to your new host, and you'll probably have to test the new site using the temporary web address or IP address given by your new web host. The whole point of this exercise is to make sure everything is functional on both ends.
If you have your own domain name, update the DNS records with your registrar only when you're satisfied that your new site works as intended.
If you have a new domain name, and you did not have one previously, simply point the domain name to the new host. Do NOT point the domain to your old host first for fun. This will cause additional complications as well as delays in domain name propagation. Propagation seems to be faster when you're pointing a brand new domain than when you're switching a domain between IP addresses.
Although the registrars tell you that the update should be completed within 48 hours or so, in practice it may take a bit longer than that for all the name servers around the world to catch up with the new location of your domain. In that interim, only some parts of the world will be able access your domain at your new host; the rest will continue to access the old site. Note that even if you see the new site in your browser, it is not necessarily true that others will see the new site. This is normal. Do not worry.
Do not, at this time, do the following:
Do not delete the old site during this interim. This will help you avoid losing visitors. Just maintain two copies of your site. Endure the inconvenience for this period. It's only a short term hassle.
Do not tell your old host just yet. Give it at least two weeks where both sites continue to run concurrently. This applies even if you're paying both hosts monthly fees. Plan to have both sites up for at least those weeks.
After the two weeks (where you maintain identical copies of your site on both your old and new host) are up, what you do next depends on whether you moved your domain name or whether your URL changed when you changed web hosts.
If you had your own domain name previously, which you moved with your site, you have little else to do. You can simply terminate your account with your old web host, and you're done. If you can afford it, wait a week or so longer to make sure that the DNS records for every internet provider and search engine have been updated. Your visitors will probably not even know that you changed hosts. Your search engine listings are not affected since they still point to the right place: your domain.
If you have been hosting with free web hosts or your old internet provider without your own domain name previously, you're now faced with the prospect of losing visitors. Visitors will be lost because they will follow old links to your site (whether from search engines or other sites) and will not find it there. Some loss of visitors is actually unavoidable, but you can do much to reduce the number lost.
The best solution I can think of is to modify your old site's .htaccess
file. Some web hosts
allow you to put a .htaccess
file in your web directories telling your web server what to do
when a visitor tries to access a file on your site. This is actually just a plain text file that you can
create using a simple text editor.
If you use Windows, you can use Notepad for this task. (Don't use a word processor like Microsoft Word, Wordpad, or the like.)
Check your old web host's documentation to see if this can be done. In general, only web hosts that use the
Apache server will have such a facility.
For each page that is under the old URL, put a Redirect statement pointing it to the new location. Take the following line for example:
Every time your visitors try to access oldfilename.html
on your old site, the server will
tell their browser to load newsitefile.html
from your new site (given as "www.example.com" in
the above illustration) instead. They will then be transparently redirected to the new host without the
requirement that they click on a link, etc. If they do not look at the location bar in their browser,
they might not even know that they had been redirected.
Search engines like Google will also follow the link to index the new address, and treat the new page as a replacement for your old one. Some of the rank associated with your old page will also be transferred to the new. I don't know if all search engines do this automatically though. Like I said, there will be some losses: you can only reduce them, not avoid them altogether.
If you're afraid that you might accidentally forget to list some page in your list of redirections, you can put a simple catch-all that redirects any remaining URLs to your new main page. The catch-all is probably only useful in catching humans that arrive at your site, and won't help you with your search engine listings. (In fact, you will lose your search engine listing for the pages you don't redirect.) It involves simply redirecting all file not found errors to the main page of your new URL (given as "www.example.com" in the code below).
If you don't have access to your old website's configuration files to do the above, the next best thing is to modify your old web pages to include the following lines in the <head> section.
The "0" in the line specifies that the browser should wait 0 seconds before redirecting. The
line with rel="canonical"
line is mainly meant for Google, to tell it the official
address for the page it is reading (see
this
article for the details, if you are interested).
If you want to display some sort of message on the page itself, you can always change the refresh rate to (say) 5 to tell the browser to wait 5 seconds. Otherwise your visitor won't be on the page long enough to read anything.
Note that "0" (or whatever time you put) and the new URL are part of the same string that is assigned to the "content" attribute. The opening inverted commas (ie, quotation marks) are before the time ("0" in our case) and the closing inverted commas are after the URL. The URL itself does not begin with any quotation marks.
If your web server (old and new) has web logs, or if you have a statistics counter that tracks referrals to your website, make a list of all the sites that sent visitors to your site. Visit those sites and see if they are still using your old URL. If so, you might want to inform the webmaster of that site of your new address.
You may probably also want to submit your new URL to the search engines. Note that search engines sometimes take forever to pick up the changes, so you just have to be patient.
How much time do you have to update the links? It really depends on how long you can keep your old site running. If it is on a commercial web host, you have as much time as you want, since you can keep paying to keep your old hosting account where your redirections live. On the other hand, if your old account is situated on a free web host, it will only be for as long as they let you keep that account. Some free web hosts, especially the smaller ones, will notice that an account has gone dormant and prune it from their system. Redirection pages also tend to lose some people along the way (not everyone follows the redirection).
My experience is that it is very difficult to exhaustively remove all links pointing to your old URL. Some webmasters can't be bothered (particularly the webmasters of sites that have not been updated for years); some cannot be traced (no email address on the site); and sometimes you fail to notice the odd site or so that rarely sends you traffic.
In general, no matter what you do, if you're changing URLs, you're bound to lose some visitors. Hopefully, the tips given above will help you reduce your losses in the confusion surrounding the move. At the very least, you will have avoided some of the problems I encountered when I moved my sites.
Copyright 2001-2018 by Christopher Heng. All rights reserved.
Get more free tips and articles like this,
on web design, promotion, revenue and scripting, from https://www.thesitewizard.com/
Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at https://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.
This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.
It will appear on your page as:
How to Transfer Your Website From One Web Host to Another