I want to block many websites on my PC. I have tried to Block them from "C:\Windows\System32\Drivers\etc\hosts" but it is not working. Some days ago i re-installed OS in my system but this problem not solved.... Please Help Me...

Here is a copy of the text written in "Hosts" file.

# 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:
#
# # source server
# x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 http://www.squidoo.com
127.0.0.1 http://www.youtube.com
127.0.0.1 http://www.twitter.com

Where twitter and youtube is added by me.

Thanks In Advance

Dani AI

Generated

As observed, the hosts file maps hostnames to IP addresses — it does not accept full URLs or protocol prefixes. That is why saw success after switching from URL-style entries to bare domain names. A compact correct example:

127.0.0.1 example.com
127.0.0.1 www.example.com
# or
0.0.0.0 example.com

Common checklist to make hosts edits reliably:

  • Back up the original hosts file first.
  • Ensure the file name is exactly hosts (no .txt extension) and it is saved as plain ANSI/ASCII (not UTF-8 with BOM).
  • Edit while logged with administrative privileges and remove any read-only attribute before saving.
  • After saving, clear the resolver cache so changes take effect (DNS cache flush) and restart browsers to clear their caches.

When blocks still do not apply, typical causes include browser/proxy/VPN bypass, DNS-over-HTTPS or DoT in modern browsers, or a security/cleanup utility that restores or locks the hosts file. Resolution checks are useful: use ping or nslookup to confirm which IP the system is resolving for a domain. If the resolution shows the real public IP instead of the loopback, the hosts entry is being ignored or bypassed.

For blocking many sites, hosts-file edits become hard to maintain and are easy to circumvent. Router-level filtering, firewall rules, or a DNS filtering service (as suggested) are far more scalable and apply to every device on the network. Hosts-file blocking is still handy for a few local overrides, but for wide or persistent blocking, DNS/router or dedicated parental-control/firewall solutions are recommended.

Recommended Answers

All 5 Replies

this might sound really dumb. but if you remove the www does it work?


you might also want to look at opendns.org - it may provide alot more easy to use blocking features for you and is fairly easy to configure and setup

I have heared about OpenDNS before...

What is the work of openDNS? Can you tell me?

what do you mean by the work? Open dns is free, you just point your primary and secondary dns to there servers. register with them , provide them your ip (if you are dynamic i think they have software) go from there it is fairly easy www.opendns.org

It worked... When i removed "" and wrote the domain (twitter.com) only the browser was unable to open website.

Thanks a lot brother..

this might sound really dumb. but if you remove the www does it work?


you might also want to look at opendns.org - it may provide alot more easy to use blocking features for you and is fairly easy to configure and setup

glad to help mahn

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.