42

I can block my little brother from accessing a website on my Mac by adding the following line to my "/etc/hosts" file.

127.0.0.1 someaddictingwebsite.com

Do Windows systems have a file analogous to "/etc/hosts"? Can I achieve the same effect on a PC?

DavidPostill
  • 153,128
  • 77
  • 353
  • 394
David Faux
  • 4,789
  • 25
  • 55
  • 71
  • Can I update the question body to add "I would like to change the IP resolution of a specific domain on Windows. This can be useful for multiple purposes, for example to do tests, emulate a website migration, or block...." in order to be able to keep this useful question, without being marked as duplicate. So the answers here can concentrate about /etc/hosts on Windows. – Valerio Bozz Sep 01 '23 at 10:11

1 Answers1

42

It's normally under \WINDOWS\system32\drivers\etc (If there isn't one, just create it).
(you have not specified OS version, win 8 monitors this file and reverts any changes, see eg. here for discussion: http://www.howtogeek.com/122404/how-to-block-websites-in-windows-8s-hosts-file/)

wmz
  • 7,102
  • 1
  • 21
  • 32