How to Block or Restrict Access to a Website on a Computer


For you to have found this page, it means you want to restrict users who are using your computer from accessing some specific websites on the internet. If that is the case, then you need not worry because today I want to show you guys how to block or restrict users from having access to some websites when trying to view them on your computer.

Blocking or restricting access to a website is mostly done on browsers but since it is possible for a user to still have access to a restricted website by using a different browser instead of the one you have used to restrict access to the website, I shall in this post show how to restrict access to any website by making some changes on the computer’s #HOSTS file so that even if the user decides to use another browser on your computer, the website will remain restricted. You don’t need to install any software at all to be able to restrict access to a website on a computer.

To do this, simply follow the steps as I have outlined below:

  • As an administrator on the computer, go to C:\\Windows\System32\drivers\etc\
  • Open the folder HOSTS using Notepad.
  • Locate the following lines on the HOSTS file
#       localhost

# ::1             localhost
  • Just below # ::1           localhost add followed by URL of the website you want to block. For example, if I want to block access to on a computer, the below image is how my HOSTS file will look like on Notepad.

Restrict access to a website on computer

  • To block more website, simply add them below the # ::1        localhost as I have indicated in the step above.
  • Finally save the HOSTS file by using Ctrl + S and then restart the computer.

In case you get an error message that reads “You don’t have permission to save in this location. Contact the administrator to obtain permission”, do the following;

  • Go back to the C:\\Windows\System32\drivers\etc\ and right click on HOSTS.
  • On the context menu that will appear, click on Properties.

Restrict access to a website on computer1

  • Click Security on the HOSTS Properties page.

Restrict access to a website on computer2

  • From the available Group or User Names, select the Administrators Account and then click on Edit.

Restrict access to a website on computer3

  • On the pop-up page that will appear, select the Administrator Account again and check the box for Full Control. Click Apply, and then Yes on the pop-up page that will come up before finally clicking on Ok.

Restrict access to a website on computer4

  • Open the HOSTS file using Notepad and follow the procedures as I have specified above. Finally Restart the computer and that is all.
  • If that doesn’t work, copy the HOSTS file to Documents or Desktop and then open using Notepad. Add the websites you wish to block as I have specified above, and then copy and paste the file back in C:\\Windows\System32\drivers\etc\.

With that done, users of that computer won’t be able to have access to any of the website you have added below # ::1       localhost in the HOSTS file and will be automatically redirected to Localhost.

If you encounter any issues while following this easy guide, please don’t hesitate to let me know.


Please enter your comment!
Please enter your name here