Moving a Site to another host

I have been working with a hosting company that I trust completely; they have always done everything perfectly & have NEVER let me down or not been responsive.

Today, however, I am having them move a WordPress site for me & I am unable to test it on their server before I change the DNS.

My environment is Windows 7. They told me I could test it by adding an entry to a file called hosts located at C:\Windows\System32\drivers\etc\hosts. I went there and added an entry to the existing file that was <ip address www.sitename.com> where ip address is the NEW ip address at the new host.

They said then open it in a browser, I did, it reverts back to the old (current) host.

My question is, I have never heard of this file "hosts" before. I'm guessing that having an entry there is supposed to make the browser go to the specified IP address for that domain name if it finds it in that file.

In FireFox it just stays with the old. In chrome, it gives a 404 error.

Is this technique supposed to work?
Richard KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Virtually all Windows, Linux, Unix, BSD, and OSX computers have a 'hosts' file since 1984.  It is used to associate IP addresses with names.  You may have to reboot your computer for it to take effect.  And some anti-virus applications make it difficult for you to edit your 'hosts' file because that has been one of the ways that viruses and malware have hikacked legitimate web sites like Google and Microsoft.

http://en.wikipedia.org/wiki/Hosts_%28file%29
Dave BaldwinFixer of ProblemsCommented:
'hosts' is found in C:\WINDOWS\system32\drivers\etc (at least on my XP system).  Below is the original basic hosts file content.  You enter an IP address and the name or domain name that you want to use to go to that IP address.  You do not include 'http' or 'www' or any extra punctuation.

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

Open in new window

junipllcCommented:
Yes, this is common practice -- an "old web developer trick." You are correct, the system should use the IP addresses in the hosts file before going to DNS, thus overriding what everybody else sees on the Internet. This isn't always the case, though.

On certain systems (mainly UNIX and Linux variants) if you ping the hostname, you get the address from the hosts file (if one exists). If you do an nslookup or dig you will get the address from DNS. This is due to the nature of each of these utilities - ping, nslookup, dig).

Be sure you have the IP address first, then some whitespace, then the hostname (Fully Qualified Domain Name, or FQDN). Go to your command line and ping that FQDN (e.g. ping www.sitename.com). See which IP you get back.

Also, check to ensure you don't have any extensions/plugins installed that may subvert the DNS lookup. I have seen this before in Firefox. Firefox actually has a keyword feature built in that can cause it to use the public DNS over your hosts file. Google keyword.enabled to see how to disable it...see if that helps.

The Chrome 404, though, is telling me that you may be trying to access a file/URL on the new site that doesn't exist. As in, truly doesn't exist. The 404 is probably correct. Just a hunch, though.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skss228Commented:
Make sure you are not passing through any proxy (make sure you have no proxy set on your browser) as the proxy will bypass the local host file entry.

Alternative!! create a test DNS A/CNAME record pointing to your new environment (ex. test.sitename.com) so that you can run a test on your new site performance as well and clear any blocker before switching the Live site.

As you said it is a wordpress site, so you can add new test (test.sitename.com) url to your configuration using wordpress admin console for testing.
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
It's now working, not sure why.

The host had me enter the IP TWICE, once with www.sitename.com and once with JUST sitename.com.

I have other issues; see next question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.