DIGIT-ARC read-only archive · snapshot: July 23, 2026

block the websites in your own pc

29 posts · originally from https://geek.digit.in/community/threads/block-the-websites-in-your-own-pc.69616/

Batistabomb
Batistabomb Original post #1
Oct 1, 2007 at 7:07 PM
guys here is the cool tchnique where you can block your pc so that childrens cannot view some x type of sites :

If you are using Windows XP., open a DOS command window, type:

notepad C:\WINDOWS\system32\drivers\etc\hosts

Lets say that you want to block hxxp://www.rediff.com

Add the following line to the file:

127.0.0.1 hxxp://www.rediff.com

Do change "hxxp to http".
File > Save. You are done!
anand1
anand1 #2
Oct 30, 2007 at 3:54 PM
How to unblock the same items ???
ray|raven
Oct 30, 2007 at 4:05 PM
I think even though its blocked this way we can access through the ip.
Not sure though.

@anand1
Just remove its entry from the file.

Regards,
ray
[xubz]
[xubz] #4
Oct 30, 2007 at 4:25 PM
rayraven said:
I think even though its blocked this way we can access through the ip.
A better method then is to ping the domain first, get the IP and then add the IP instead of the Domain.

It blocks both :)
Batistabomb
Oct 30, 2007 at 4:33 PM
if you want to block through ip then change regedit key to ip address instead of domain name
victor_rambo
Oct 30, 2007 at 4:54 PM
[xubz] said:
A better method then is to ping the domain first, get the IP and then add the IP instead of the Domain.

It blocks both :)
but what if the ip is shared between domains?

wudn't all the sites on that ip be blocked?
gdatuk
gdatuk #7
Oct 30, 2007 at 6:59 PM
let me try and let u know tonight....
my brother is a constant pest...

he uses my high end dell to orkut ...need to put an end to this today.... grrrrrr
azzu
azzu #8
Oct 30, 2007 at 8:30 PM
^^ work's well nice Bro
R
Oct 31, 2007 at 12:50 PM
Hey it didn't worked for me.
Batistabomb
Oct 31, 2007 at 2:23 PM
roxisayshi said:
Hey it didn't worked for me.

did you typed what exactly i shown above, did you gave space between 127.0.0.1 and your address

if not try https
M
mehulved #11
Oct 31, 2007 at 3:13 PM
What you're doing anyways is assigning the hostname to your PC. 127.0.0.1 is the IP of the loopback interface, i.e. the PC itself. Anyone running a web server on their PC try this, it should return you the default page on your web server when you try the name of that site you blocked.
Pathik
Pathik #12
Oct 31, 2007 at 3:25 PM
Yup.. this is a old trick.. wen u do this it tries to access the site in 127.0.09.1 wich is lcalhost and hence doesnt find any page and gives an error..
Batistabomb
Oct 31, 2007 at 3:31 PM
pathiks said:
Yup.. this is a old trick.. wen u do this it tries to access the site in 127.0.09.1 wich is lcalhost and hence doesnt find any page and gives an error..

That's correct dude, do you have any idea about symbian phones
Pathik
Pathik #14
Oct 31, 2007 at 6:10 PM
You mean a similar trick for symbian???
just create the site's bookmark and keep its default apn something with wrong proxy settings such that it wont connect..
Batistabomb
Oct 31, 2007 at 6:49 PM
no no pathiks iam symbian software engineer for series 60 mobiles i want help regarding programming
R
Oct 31, 2007 at 10:03 PM
@batistabomb

I did exactly what is written earlier by you. Also, gave space between 127.0.0.1 and address. Tried * as well.

Somehow, I couldn't able to block the desired website which happens to be none other than orkut. My sis is addicted to it. I need to block it by any means. Help me guyz.
satyamy
satyamy #17
Nov 1, 2007 at 3:25 AM
not working on my PC :(

I have seen in my Friends PC his engineers has blocked orkut.com in his PC and just when you type orkut.com before pressing enter key 1 message come with a sound (muhhhhhhhaaaaaaaaaaa............)
and message says
[
"You Fool, Orkut has been banned by Administrator"
Muhuhahaha!
]

how is this done ??
any idea ???
Sukhdeep Singh
Nov 1, 2007 at 7:34 AM
satyamy said:
not working on my PC :(

I have seen in my Friends PC his engineers has blocked orkut.com in his PC and just when you type orkut.com before pressing enter key 1 message come with a sound (muhhhhhhhaaaaaaaaaaa............)
and message says
[
"You Fool, Orkut has been banned by Administrator"
Muhuhahaha!
]

how is this done ??
any idea ???

*www.thinkdigit.com/forum/showpost.php?p=547769&postcount=15

@roxisayshi : dont add anything in front...Do this simply

127.0.0.1 orkut.com
127.0.0.1 www.orkut.com
the.kaushik
Nov 1, 2007 at 8:49 AM
not working for me..
Code:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
127.0.0.1 *www.rediff.com/
what i made wrong????
N
Nov 1, 2007 at 8:58 AM
Try rediff.com instead of complete url.
delta4
delta4 #21
Nov 1, 2007 at 9:11 AM
This Is The Correct Way...end This Topic Now...

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 www.redif.com
M
mehulved #22
Nov 1, 2007 at 11:48 AM
Check the man page for hosts *unixhelp.ed.ac.uk/CGI/man-cgi?hosts
Though this one is for *nix, it should be similar windows too.
Host names may contain only alphanumeric
characters, minus signs ("-"), and periods ("."). They must begin with
an alphabetic character and end with an alphanumeric character.
Optional aliases provide for name changes, alternate spellings, shorter
hostnames, or generic hostnames (for example, localhost).
As far as my understanding goes, hosts are not determined by protocol eg. http as being used here. It will only contain the FQDN of the host.
fully qualified domain name (or FQDN) is an unambiguous domain name that specifies the node's position in the DNS tree hierarchy absolutely. To distinguish an FQDN from a regular domain name, a trailing period is added. ex: somehost.example.com. An FQDN differs from a regular domain name by its absoluteness; a suffix will not be added.
A FQDN is not the same as a Uniform Resource Locator (URL) as it lacks the protocol name to be used in communication with the host. A URL always starts with "<scheme>:", and so includes the communication protocol (like "http:", or "ftp:"), and includes information specific to the scheme, such as a directory path, a filename and a TCP port number.
Source: - *en.wikipedia.org/wiki/FQDN

Please check this out. And if I am right then the first post needs to be edited to remove the http part.
Pathik
Pathik #23
Nov 1, 2007 at 1:48 PM
^^ isnt it that wen u use the url, u r being more specific..
if u use the fqdn it blocks all the connections to that domain name be it http or ftp..
I
ismart #24
Nov 1, 2007 at 4:41 PM
i knew...yet nice info
V
vaibhavtek #25
Nov 1, 2007 at 4:47 PM
hey doesn't work...

I type:-

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 hxxp://www.rediff.com

And when I enter www.rediff.com in my address bar and press enter it shows me rediff...

What is wrong..?????

Please reply.
M
mehulved #26
Nov 1, 2007 at 9:40 PM
pathiks said:
^^ isnt it that wen u use the url, u r being more specific..
if u use the fqdn it blocks all the connections to that domain name be it http or ftp..
Nope. hostname doesn't have a protocol cos one host can serve many different services. I can run ftp, http, samba, dns and a hell lot more on my PC, while keeping one hostname.
The idea behind the hostname file is to uniquely identify the client within the domain and fqdn is to gather all hosts within one domain.
It wouldn't be uncommon to find, within a domain, one host running firewall and NAT, another running proxy and LDAP, another serving DNS, a couple of hosts running http, ftp, db servers.
fqdn is different from url as said in that wikipedia article.
Your domain *www.foo.bar may lead to the host loo.foo.bar where loo is a host within the domain foo.bar. Instead it could even be loo.abc.xyz. fqdn needn't be the same as the url. If the internal DNS is set up fine that it will all be routed properly within the internal network.
Now how does this matter?
By default, on whatever OS's I have used, hosts are read from local files first. On linux my hosts line in /etc/nsswitch.conf file look like this
Code:
hosts:  files dns
So, firstly a host name will be checked up on local host file, which happens to be /etc/hosts. If it's not found it will fall back on the DNS server.
So, now when you will look up for a host name, irrespective of the protocol used - be it http, ftp, rsync, ldap whatever, first the /etc/hosts file will be looked up. Since, your blocked host points to localhost it will try to connect the service on your own PC. And if it doesn't find any server running on that port it will give an error. If it finds any server running on your PC for the server, it will connect to it.
So, after blocking this if you run an apache server it will connect to your own PC on port 80.
But, if you specify *abc.xyz it becomes an invalid fqdn(see the wikipedia entry in my previous post).
V
vaibhavtek #27
Nov 2, 2007 at 4:20 PM
hey why I am not able to block...??

Please look at my previous post..

Plzzzzz reply.
R
Nov 2, 2007 at 7:41 PM
@vaibhavtek

Hey, it finally worked for me and can also work for you.
Just restart your browser for these changes to take effect.
That's it.
I was doing exactly what is mentioned in the very 1st post of this thread but did not able to block websites. Later on, I found that the changes will take effect only when the browser is closed and reopen again.

@batistabomb
Thanks
Batistabomb
Nov 2, 2007 at 8:05 PM
Guys i thought you clearly restarts browser that's why i did not mentioned specially

Any how better restart your system instead of restarting the browser