Sometimes, for various reasons, we may need to prevent some websites from being accessed from a computer or laptop. The method below (domain mapping) is a simple and unconventional one, through which you can block access to certain websites without using a firewall or antivirus software.
Thus, you can very easily block access to facebook.com, instagram.com or other domains, from a computer with an operating system Windows.
Update: The method was briefly described and here.
How does the "domain mapping" method work?
Through domain mapping the user can change the IP address of a domain locally of Internet. So when accessed from a web browser (Chrome, Safari, Firefox, etc), the domain name will "route" to an IP set by the user instead of the actual IP it is running on.
For example, the facebook.com is the domain name. In order for a web page to exist on a domain name, this name must be based on an IP address that leads to the host server.
Through the file "
hosts” you can change the IP addresses of Internet domains locally. The domain name will lead to the IP address entered by the user in the file “
hosts", instead of answering the real IP address. This way you can block access to certain websites or game servers that use domain names in the configuration (example: s1.game-server.tld).
How do you block access to certain websites on Windows?
To block access to certain websites from computers with Windows, the simplest is to locally define another IP address of the domain on which the website is located. As I said above, through the file "
hosts” the destination / route of an internet domain can be changed.
The method is applicable on all operating systems: Windows XP – Windows 11.
1. Open the text editor Notepad with privileges administrator.
2. Go to the operating system files Windows to the file "
3. Open and edit the file "
hosts". It has no extension.
4. Add new lines where you assign other IP addresses for domains (host names) that you want to block.
For example, if you want to block access to Facebook and Instagram, add to the file "
hosts” lines below.
4. Save the changes made.
After this step, the websites located on the domain names for which the IP address was changed, will no longer be accessible from that computer.
If you want to cancel the restrictions, it is enough to edit the file again "
hosts” and put the symbol “
#” in front of each line.
It is quite possible that after more important updates of the operating system (Windows Updates), this file "
hosts” to be rewritten or automatically replaced with the original one.
A simple method of domain mapping through which you can block access to certain websites without using a firewall or antivirus software.