# block the websites in your own pc



## Batistabomb (Oct 1, 2007)

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 (Oct 30, 2007)

How to unblock the same items ???


----------



## ray|raven (Oct 30, 2007)

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] (Oct 30, 2007)

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)

if you want to block through ip then change regedit key to ip address instead of domain name


----------



## victor_rambo (Oct 30, 2007)

[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 (Oct 30, 2007)

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 (Oct 30, 2007)

^^ work's well nice Bro


----------



## roxisayshi (Oct 31, 2007)

Hey it didn't worked for me.


----------



## Batistabomb (Oct 31, 2007)

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


----------



## mehulved (Oct 31, 2007)

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 (Oct 31, 2007)

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)

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 (Oct 31, 2007)

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)

no no pathiks iam symbian software engineer for series 60 mobiles i want help regarding programming


----------



## roxisayshi (Oct 31, 2007)

@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 (Nov 1, 2007)

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)

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
> ...



*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)

not working for me..

```
# 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????


----------



## navjotjsingh (Nov 1, 2007)

Try rediff.com instead of complete url.


----------



## delta4 (Nov 1, 2007)

*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*


----------



## mehulved (Nov 1, 2007)

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 (Nov 1, 2007)

^^ 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..


----------



## ismart (Nov 1, 2007)

i knew...yet nice info


----------



## vaibhavtek (Nov 1, 2007)

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.
> #
> ...



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

What is wrong..?????

Please reply.


----------



## mehulved (Nov 1, 2007)

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

```
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).


----------



## vaibhavtek (Nov 2, 2007)

hey why I am not able to block...??

Please look at my *previous post*..

Plzzzzz reply.


----------



## roxisayshi (Nov 2, 2007)

@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)

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


----------

