To carry out this task of blocking websites we will use 'hosts' file. Locations of 'hosts' file for various operating systems are as follows:
Unix------------> /etc/hosts
Unix------------> /etc/hosts
Windows------> %SystemRoot%\system32\drivers\etc\hosts.
Following image shows modified content of 'hosts' file.
Following image shows modified content of 'hosts' file.
![]() |
| hosts file |
Let us block website named 'www.facebook.com' so that whenever user types 'www.facebook.com' in address bar of browser, user is redirected to 'www.google.com'. First we find out IP address of 'www.google.com'. It is 173.194.38.176. File 'hosts' lists IP address and website name separated by white space on each line. When user types name of website in address bar of browser, content of this file is checked to find out corresponding IP address of website name typed by user. If match is found, then user is redirected to IP address which precedes website name. As shown in above image we have put IP address of website 'www.google.com' i.e. 173.194.38.176 before website name 'www.facebook.com'. Everytime user types 'www.facebook.com', he/she is redirected to 'www.google.com'. In case if 'hosts' file is read only then use its properties to manage permissions. Sometimes 'hosts' is not allowed to be edited. In such case copy 'hosts' file to desktop, edit it and then paste edited file back in folder to which it belongs.
Steps:
1. Open 'hosts' file.
2. Find out IP address of website where user needs to be redirected.
3. Put IP address of site where user is to be redirected and name of website to be blocked
separated by white space on single line of 'hosts' file.
4. Save 'hosts' file.
5. Close 'hosts' file.
6. Restart computer.
1. Open 'hosts' file.
2. Find out IP address of website where user needs to be redirected.
3. Put IP address of site where user is to be redirected and name of website to be blocked
separated by white space on single line of 'hosts' file.
4. Save 'hosts' file.
5. Close 'hosts' file.
6. Restart computer.

No comments:
Post a Comment