Chat with us, powered by LiveChat How to test a website using your computer's hosts file - Synergy Wholesale

How to test a website using your computer's hosts file

Category: DNS

This method involves making a small adjustment to your computer’s Hosts file.

Doing this will essentially trick your computer into loading data for a requested site from the server IP address you provide in the hosts file rather than looking up where the domain points to on the internet from it’s nameservers.

Depending on your operating system, the location of your hosts file may vary which we will go into below.

CAUTION: You may not be able to access this file on a public or office computer as it will be locked down. As such this will not be an available option from such a device.

We recommend not using this on a system not owned by yourself.

Windows 7, 10:

You can find the hosts file under C:\Windows\system32\drivers\etc\hosts

To get here quickly from the desktop press your windows key and type in “run” and press enter, this should present something like the below in the bottom left of your screen:

In the box provided enter  the following:

C:\Windows\system32\drivers\etc\hosts

and press OK to open the folder containing your hosts file.

You then just need to right click on “hosts” and select “open with”, On the prompt that opens up you should select “Notepad” and then OK.

(If you receive an admin confirmation pop-up, press OK)

It should look something like the below once opened:

At the very bottom of the document below the lines starting with hashes (#) you need to enter the IP address of the server you want your site to load from then the domain name for your site after one space like below:

Once this is added you just need to save this document by selecting File > Save, then close it.

Finally close off the host file and open a fresh browser of your choice to test your site, It will now load from the IP address you specified in the host file on this device only, all others will still load from the nameservers that are set on the domain.

Linux and MacOS X:

You can find the hosts file under /etc/hosts

The easiest way to edit this will be with Finder, So open a new Finder window.

  • Select Applications from the left sidebar
  • Double click on Utilities from the list given in the right side.
  • Double click Terminal to open it

Type in the following:

sudo nano /etc/hosts

on the prompt and hit enter.

This will request the devices administrator password to continue.  Once the correct password is supplied it will display something like the below:

In this file we just need to add 2 lines, One for your root domain and one for www. Just to cover any type of configuration your site may be using. It should be set as follows:

IP Address domain.name
IP Address www.domain.name

Once complete press “CTRL + O” to commit the changes then “CTRL + X” to exit back to terminal.

When you exit it will return you to the terminal prompt, you will need to run the following command to flush your system network cache to make sure it recognises the changes we just made.

Type in:

sudo killall -HUP mDNSResponder

and then hit enter,

Again, This will request the devices administrator password to continue.

Finally close off the terminal and open a fresh browser of your choice to test your site, It will now load from the IP address you specified in the host file on this device only, all others will still load from the nameservers that are set on the domain.

More Info Request
  • Select All
  • Sample Pricing Guide
    Due to the nature of our services as a wholesale provider, we do restrict full pricing from being released. You can request a sample pricing guide to give you some insight as to what you can look forward to by becoming a partner with Synergy Wholesale.
  • API Information
  • Whitelabel Billing Information
  • Migration Process
Required
* Required
Thank you for submitting a More Info Request!
An email will be sent to you shortly with the requested information.
Begin your 7-day free-trial today!
Get Started
Close