My CloudVPS

Article overview

/ Tests with the hosts file

A good way to test a website for which the DNS has not yet been changed is to make use of the hosts file. This enables you to visit a website before the DNS is pointing to it.


edit the file C:\WINDOWS\system32 ¬

OSX / Linux

Edit the file /etc/hosts as the root user in a terminal window.
In OSX you can find the in Applications > Utilities > Terminal.

Now enter the following

(on one line): ¬
Where is the IP address of the destination and is the domain name you want to test.
Now clear the browser cache and flush your local DNS cache.


Call up a command line via Start > Run > cmd and enter the command:
ipconfig /flushdns


Restart the nscd daemon by entering the following in a terminal window (on one line):
/etc/rc.d/init.d/nscd ¬


Enter the following in a terminal window:
OSX prior to 10.5:
lookupd -flushcache
OSX 10.5 or later:
dscacheutil -flushcache


Restart your browser and surf to the test domain.
To make sure you are now on the right server, you can change something on the website. Or use Firefox in combination with the add-on ShowIP, which shows the IP address of the current page in the bottom right corner of your status bar.

To once again connect to the old server, remove the line from your hosts file, empty your browser's cache, flush the local DNS cache and restart your browser.

Share this article