Want to know how your website would behave on Domain? Hosts file is the answer.

Lesser known but critical file, hosts file, is a simple text file without a file extension is designed to map or override IP addresses before accessing a DNS (domain name server). In simple words, the “hosts” file overrides any request to a DNS server for a domain name resolution, meaning that you can override where your computer connects to by editing this file as you wish. Another benefit of using the hosts file is precedence.If a hosts file exists, it is automatically searched during any process using the OS TCP/IP stack. The search is done first before any attempt to find a DNS server is made.

hosts-file

Lets say your website is deployed on your test server with IP@ 192.168.1.3 and would exist on mysite.com domain well pushed LIVE. So, you must want to see how your website and its pages are behaving when Domain Switching would done on your Production and available to end user. The simple solution is update the hosts file on your local machine with below configuration:

So, once you save the hosts file with this configuration, you can browse the complete website using http://mysite.com on your web browser. Isn’t that Simple & Reliable?

Location of Hosts File

Windows 8, 7, Vista, XP & NT/2000%SystemRoot%system32driversetc
Mac OS X/private/etc/hosts
iOS, Android, Unix/Linux/etc/hosts

Other hidden benefits of hosts file includes:

  1. Substitute One Domain Name For Another
  2. Blocking Malware or Undesirable Sites
  3. Ad blocking
  4. Speeding Up Browsing

Enjoy!!

 

  • Anamika Yadav

    How to do Host entries in Mac machine:
    Open the Terminal in Mac Machine. It’s located at /Applications/Utilities/Terminal.app
    Enter the command: sudo nano /private/etc/hosts
    Enter host entries and save it by pressing Control + O keys. (letter O, not zero).

  • Pingback: How to verify AKAMAI configuration on Staging? - Technowide()