Geeknaut

How to Block a Website

windows features off

Sometimes you have a need to block a website.  Perhaps for the safety of a family member or even security reasons in the workplace.  Here are the easy steps to get this accomplished.

This method can be used in any browser, but it requires the edit of your Host File. Before making any changes to the Hosts file, you should create a backup copy, in case you need to revert to the original. There may be different procedures required for different browsers, but the hosts file is common to all systems and should work independently of the browsers.

Locating your host file is very easy. Type C:/Windows/System32/drivers/etc. in the address bar of an open Explorer window.

  1. Double-click the hosts file and open with Notepad when prompted. The hosts file directs the system when certain IP addresses or domains accessed. You can issue instructions to the system when sites, domains, URLS, or addresses are accessed.
  2.  Once inside hosts, find the line “127.0.0.1 localhost” or “:1 localhost”. and place your cursor at the end of the line.
  3.   Enter a new line and type in the address of the site or sites, each on a new line, to which you want to prevent access.
  4.   The website must be prefaced by “127.0.0.1” Eg to block “badsite.com” you will enter “127.0.0.1” then a single space followed by “badsite.com”. Be sure to enter each site on a new line.
  5.  Save the hosts file. If you are prompted for administrator permissions, in order to save the file, you can change to administrator, by following the following procedure.
  6.  Right click on the hosts file, and select Properties, then Security. Check all boxes before saving the changes, and this should allow you to save the file as an administrator.

The process is the almost the same with a Mac, but the process for locating and editing the Hosts file may be different. In a Mac, the hosts file is found with the Terminal utility. Once Terminal is open, the following code should be entered.

  1.  sudo /bin/cp /etc/hosts /etc/hosts-original
  2. You will be asked to enter your password to open text edit with the following command line.
  3.  sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
  4. The hosts file will be opened in a separate window. If it is locked, you can unlock it by clicking unlock in the menu under Locked.
  5.  Locate the line “fe80::1%lo0 localhost”  in textedit and create a new line under it, where you can enter the site(s) you wish to block. Each address or location must be prefaced by 127.0.0.1 followed by a space.

Save the changes before you exit. It is easy to check to confirm, whether the sites that you have entered are blocked. Simply enter the URL or IP address in your address bar, and you should receive an error message indicating that the browser is not able to access the site.

 

 

Exit mobile version