28-08-2011, 09:35 PM
How to block / redirect websites using the Windows host file
Really quick one liner of what a host file is.
The hosts file is a computer file used in an operating system to map hostnames to IP addresses. The hosts file is a plain-text file and is traditionally named hosts.
Steps
1) The file we're looking for is located in C:\Windows\System32\drivers\etc
2) Open the hosts file in Notepad.
3) Your hosts file will look similar to below, (except I have a few other entries in mine that I've blurred out...) simply add the desired website at the bottom, eg.
127.0.0.1 websitehere.com
That will redirect websitehere.com to 127.0.0.1 (localhost)
4) File > Save As > hosts
Make sure All Files is selected (*.*)
5) Try to get to the website...
6) And if we try a ping...
Simple. Remember this only works on the machine that you do it on.
Really quick one liner of what a host file is.
The hosts file is a computer file used in an operating system to map hostnames to IP addresses. The hosts file is a plain-text file and is traditionally named hosts.
Steps
1) The file we're looking for is located in C:\Windows\System32\drivers\etc
2) Open the hosts file in Notepad.
3) Your hosts file will look similar to below, (except I have a few other entries in mine that I've blurred out...) simply add the desired website at the bottom, eg.
127.0.0.1 websitehere.com
That will redirect websitehere.com to 127.0.0.1 (localhost)
4) File > Save As > hosts
Make sure All Files is selected (*.*)
5) Try to get to the website...
6) And if we try a ping...
Simple. Remember this only works on the machine that you do it on.