Image

Your hosts file tell your computer what server to look at first when going to a URL. Each website has a numerical address (IP).

The Hosts file is typically used to block access to unwanted websites like ad-servers or servers malicious code (viruses etc). Some viruses (on PCs) will use the hosts file to have your computer do unwanted things, and some "hacks" like jailbreaking your iphone will tell apple updates to point to the jailbreak ips for updating. 

Host can be used to test a website before deploying it, let go over how that is done.

In Mac OSX or Linux

  • Open terminal
  • run command: sudo pico /etc/hosts
  • Enter password, hit enter
  • Write a line like: 59.56.31.69 example.com
  • hit "ctrl x" and hit "Y" to save and exit
  • go visit your example.com (it will now resolve using the 59.56.31.69)

To edit in In Windows XP

C:\WINDOWS\system32\drivers\etc\hosts