Block websites on your computer or someone else’s computer
Block websites on your computer or someone else’s computer:
Press WIN+R
and type this %windir%\system32\drivers \etc
or navigate to C:\Windows\System32\drive rs\etc
and now you will see the hosts file
Now open notepad from start menu by typing notepad and running it as an administrator.
Open the hosts file by navigating to C:\Windows\System32\drive rs\etc.
Now if you want to block site say facebook and google then type these lines(Marked in red rectangle)
The next time you open google or facebook it will not open.(Note:This trick will work if your browser is not open.If your browser is open close the browser and restart it.)
Using this property you can do website redirecting . For example if someone wants to open facebook but you want them to be redirected to google. First we need to know the ip address of Google . To do that open cmd and type tracert google.com in cmd and note down the ip address of Google as shown in the pic
Now Google ip address is 216.58.220.46 . hence I will be typing this in notepad
Now the next time you try to open facebook you will be redirected to google.
To unblock websites open the hosts file in notepad and delete those lines
For linux users :
Open terminal and type these lines,
First create a backup of the hosts file given below :
- sudo cp /etc/hosts /etc/hosts.bak
Suppose you want to block google website then type this
- sudo sh -c 'echo "0.0.0.0 http://google.com">>/etc/hosts'
or type this
- sudo sh -c 'echo "127.0.0.1 http://google.com">>/etc/hosts'
Just replace google with any other website to block that website
To unblock websites type this
- sudo cat /etc/hosts.bak>/etc/hosts
No comments: