Is there a way to block certain URL’s in IE?
Actually, there is, yes. But when you do it, you’ll be blocking them in IE
and any other program that might attempt to access them.
Interestingly enough, it’s the same technique that some viruses use to block
you from getting to anti-virus sites.
Become a Patron of Ask Leo! and go ad-free!
Normally Windows uses what’s called DNS to map a domain name, such as
“microsoft.com” to an IP address, like “220.127.116.11”. It’s easier for you
and me to remember domain names, and this also allows the domain name owners to
change their internet addresses at will.
The “hosts” file is a plain text file that can contain overrides to DNS. In
it you can hard-code the IP addresses that domain names will map to. Normally,
it’s not used at all, but it’s a great opportunity to block access to domains
you don’t want accidental access to.
The hosts file is typically found in
“c:\windows\system32\drivers\etc\hosts”. You may need to change the file’s
read-only attribute so that you can make changes. Open it in notepad.
You should notice an entry like this:
That defines the IP address of “localhost” to be 127.0.0.1, which by
definition is your own machine.
To block a site, just add a similar entry to the end of the file. For
Now “www.badsite.com” is mapped to your machine. Since you’re probably not
running a web server, any attempt to visit that site using a browser will fail.
In fact, ANY attempt to use “www.badsite.com” will get directed to your own
machine and will typically fail.
The only caveat is that addresses are often cached by the software. That
means you may need to exit all instances of your browser, for example, before
the blockage becomes apparent. In the worst case, reboot, and it should take
By the way, if you open the hosts file and find a long list of what look
like anti-virus site domains, you’ve been infected by a virus and probably
want to scan as soon as possible. And feel free to delete those entries from