Edit the Windows Hosts File to Block or Redirect Websites
Additionally, protocols which are employed by programs and applications
The Windows Hosts file is just a file that Windows utilizes to manage and map internet protocol address details. By modifying the Hosts file, Windows could be personalized to block or redirect particular sites and also protocols which are employed by programs and applications.
To get going modifying the Windows Hosts file, you need to find it. Start Windows Explorer and then click on This Computer or My Computer. Double-click on C:\, then Windows scroll and folder listed below until such time you reach the System32 folder. Inside of this folder, available drivers and then open etc. You’ll now see a few files, one of which will be hosts.
Now, observe that the file kind for the hosts file is detailed as File. Since there is no standard system set to start a file kind similar to this, dual clicking the hosts file will just provide you with a Windows prompt, asking you which program you desire to used to start the file.
Using this prompt, you are able to elect to modify the hosts file with Notepad. Therefore, click on to select Notepad and then click the button that is OK. After that, Notepad will introduce utilizing the hosts file information.
In this manner of starting the hosts file had been shown to show in which the hosts file is in fact positioned within Windows, you won’t manage to modify it since it’s system file. So that you can modify the file, you must open Notepad first, running as an Administrator.
Click on begin and key in Notepad, but don’t click on Notepad to open up it. Instead, right-click the Notepad listing to create within the context menu. Find the option Run as Administrator.
With Notepad open, choose File > Open. Navigate to C:\Windows\System32\drivers\etc. You get a blank display that shows the prompt No products match your re search. Change Text papers (*.txt) to all or any Files making use of the drop down menu. Now, you are able to choose the hosts file and click Open.
Including files to your hosts file really is easy. The hosts file makes use of the structure:
Blocking a web page in Windows is really as straightforward as typing the next to the base of this hosts file:
Therefore, if i needed to block an online site like www.nytimes.com, I really could simply add the after line:
Everything we are now actually telling Windows is the fact that the site www.nytimes.com should redirect towards the internet protocol address 127.0.0.1, which will be simply the loopback target on our neighborhood system. In the event that you don’t have a website that is local on your pc, you’ll just get a mistake page in your online web web browser.
Pretty cool, huh!? clearly, you can view exactly how this could be utilized in many different methods: a prank, parental control, etc. in the event that you didn’t would you like to block the internet site by doing so, you might like to redirect it to a different internet site. To carry out this, you need to discover the internet protocol address associated with the other site first.
To do that, just open a command prompt ( simply simply simply click on begin and key in CMD) and key in the after demand:
In my own instance, We pinged Adobe.com. The internet protocol address is 22.214.171.124. Now I am able to just connect that true number into my hosts file in front of www.nytimes.com.
Now once I see www.nytimes.com, We get redirect to Adobe.com! Sweet! Keep in mind that when this does not work with the internet sites you might be entering, maybe it’s due to the URL you will be making use of. For instance, a difference is made by it if you utilize www.nytimes.com instead of nytimes.com with no www. Look at the site and determine precisely what the URL is when it comes to web site you want to redirect. You ought to constantly decide to try with no www first to see if that works.
In the event that web site makes use of HTTPS like Google.com or something, wix it must nevertheless redirect if the host is used by you title. There isn’t any option to specify the HTTPS form of an online site in the HOSTS file, nonetheless it should redirect the HTTPS and non-HTTPS versions associated with internet site if you are using simply the host title (for example. google.com).
Finally, you need to use the hosts file to generate shortcuts that are simple your own personal products in the community. For instance, my router are at 192.168.1.3 on my house system, but i possibly could add the line that is following my hosts file and just key in myrouter.com into my target club.
It does not really make a difference if myrouter.com is truly an online site or perhaps not since the hosts file is read first and you’re rerouted towards the internet protocol address specified into the file. It’s worth noting that perhaps not the hosts may be used by all browsers file, therefore if it is no longer working, that may be the problem. We tested it making use of IE, Microsoft Edge, Chrome and Firefox and it also labored on all the browsers.
Overall, the hosts file continues to be helpful, even yet in Windows 10. In addition it nevertheless works fine in Windows 8, 7, Vista, etc. When you have any concerns, please feel free to comment. Enjoy!
Founder of on the web Tech Tips and handling editor. He started blogging in 2007 and stop their work this season to blog full-time. He’s got over 15 many years of industry experience in IT and holds a few certifications that are technical. Browse Aseem’s Complete Bio