
Create your own parental control system by filtering access to prohibited sites from your computer.
Moderating access to certain online content can be more difficult than it appears. While there are turnkey solutions, such as Cloudflare’s DNS resolver 1.1.1.1 for families, to block access to certain sites from your PC, it is also possible to proceed on a case-by-case basis and not block the site. ‘access from your computer only to the sites you have defined.
Also read: How to automatically block malware and adult content on your PC or Mac
To do this, you must modify the file hosts Windows. This small file, stored in the twists and turns of the operating system, is indeed queried first, before the DNS query is sent when you attempt to access a website.
By modifying it correctly, you will be able to assign to certain URLs a local IP address so that the page of said site does not load in the web browser. Here’s how to do it.
1. Open Notepad in “administrator” mode
Click on the Start menu and search for Notepad. Right click on it and choose to run it as administrator.

2. Open the hosts file in Notepad
In Notepad, click File, and then click Open. In the explorer window that appears, click in the address bar and paste the following path to open the directory containing the file hosts.
C: Windows System32 drivers etc

Make sure the File Explorer displays All Files. You should normally see a list of several files appear, including the famous file hosts. Select it and then click on the Open button.

3. Edit the hosts file
By default, the file displays instructions, as well as several examples of what you can do. The # sign is used here to create comments. Thus each element indicated after a # is not taken into account by the hosts file.
To block access to a website, you must therefore associate its URL with an IP address leading to nothing, such as a local IP address: 127.0.0.1.
To block access to Facebook, Twitter, YouTube, etc., you will therefore indicate:
127.0.0.1 www.facebook.com
127.0.0.1 www.youtube.com
Repeat as many times as necessary for the sites to which you want to block access from your machine. Note that for some websites, you will need to enter several URLs to be able to block all the domains attached to the site to be blocked. You can find this information quite easily by launching a query in Google.
When you have filled in all the URLs you want to block, save the file by using the keyboard shortcut Ctrl + S, or by clicking on File and then on Save.

If the hosts file is filled in correctly, attempts to access blocked sites should result in a page indicating that the site is unreachable. If not, restart your machine for the changes to take effect.

If you change your mind, you can go back and unblock filtered sites very easily. Open the hosts file again from Notepad as seen previously, delete the lines, and save the hosts file.