If you want to block Internet access to a website on a Microsoft Windows computer, you can use the hosts file located in the C:WINDOWSsystem32driversetc directory to block the internet connections to the website.
When you don’t want your children or anyone who uses your Windows computer to access certain websites, the easiest way to force them to follow your rules is to modify the Windows hosts file. To be able to edit the Windows hosts file, you need to open the hosts file with administrative right.
This post provides information you need to block internet access to any website on Microsoft Windows.
There are many ways to open a text editor as administrator, you can find your text editor and right click on it and select run as administrator or open command prompt or PowerShell as administrator and type the name of your text editor to open it.
In the command prompt or the PowerShell window, enter the directory that contains the hosts file and type:
To block access to the YouTube website, type:
save the file.
Every time you will try to access the YouTube website, your browser will send you back to your computer.
I recently published the post Error 1020 access denied, who has resolved the common problem “Error 1020 access denied" when certain IP address try to access content from certain websites.
If you want to block another website, just add a new line. For example, if you want to block internet access to Facebook website, type:
save the file.