Hi,
Welcome to Q&A platform.
Please try the following methods to see if it was helpful:
Log in to your PC with administrator account and got to C:\Windows\System32\drivers\etc.
Double-click on the file called "hosts" and select Notepad in the list of programs to open the file.
Click on OK The last two lines of your hosts file should read "#127.0.0.1 localhost" and "#::1 localhost".
In case you cannot edit the file, you must right-click on the file called hosts and select Properties. Click on the Security tab, select the administrator account, and click on Edit. In the pop-up window, select the account again and check Total Control. Click Apply> Yes. Now click on OK in all pop-up windows.
At the end of the file, you can add the addresses to block websites. You just need to add a line to the end of the file using 127.0.0.1. Then put the website name you want to restrict. This will transmit the name of the site to your local PC. To block Google, for example, add "127.0.0.1 www.google.com" to the end of the file without the quotes. You can block as many sites as you want in this way, but remember that you can only add one per line.
Repeat this step until you have added all the websites you want to block.
Now close the hosts file and click Save. Restart the computer for the changes to take effect.
For more methods, you could also refer to the following link:
How to block a website on a Windows 10 computer in 2 different ways
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
Best Regards,
Sunny
----------
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.