Recommended Posts

I am trying to block a website through the Hosts file, but the site still loads, despite being supposedly redirected to 127.0.0.1. What I have done is put 127.0.0.1 domain name in the hosts file and saved it, I have verified that it is saved, but when I go to the website, it still loads, even after reboot. Am I missing something or doing something wrong? Or is it windows?

Link to comment
https://www.neowin.net/forum/topic/1381876-website-blocking-via-hosts-file/
Share on other sites

  On 18/04/2019 at 03:06, jnelsoninjax said:

I am trying to block a website through the Hosts file, but the site still loads, despite being supposedly redirected to 127.0.0.1. What I have done is put 127.0.0.1 domain name in the hosts file and saved it, I have verified that it is saved, but when I go to the website, it still loads, even after reboot. Am I missing something or doing something wrong? Or is it windows?

Expand  

You need to ipconfig /flushdns

make sure your hosts file hasn't been saved as hosts.txt by mistake as well

  • Thanks 1

Who does this anymore?  Run pihole if your looking to block ###### ;)  Or block it on your dns directly with a host override?

 

Do a simple ping does it come back as 127.0.0.1?

 

Also if your browser is using a proxy, doesn't matter what you put in your host file since proxy is what resolves, not the local client.

 

But to your use of host file... Here how to test your setting is working... Keep in mind that hosts file will need admin rights to manipulate... Its also possible your running some antivirus software that prevents manipulation of the hosts file.. And yeah sagum is right, many users will save it has hosts.txt which never used.

 

 

 

 

hostfile.png

Hello,

You need to make sure that you have entered the fully-qualified domain name (FQDN) into the hosts file.  For example, if you wanted to block https://www.example.com/ you would want to enter the following lines into the hosts file:

 

127.0.0.1 example.com
127.0.0.1 www.example.com

Note that you do not enter the protocol handler (https, http, ftp, et cetera), just the applicable hostnames.

 

Regards,

 

Aryeh Goretsky

  On 26/04/2019 at 03:37, goretsky said:

Hello,

You need to make sure that you have entered the fully-qualified domain name (FQDN) into the hosts file.  For example, if you wanted to block https://www.example.com/ you would want to enter the following lines into the hosts file:

 

127.0.0.1 example.com
127.0.0.1 www.example.com

Note that you do not enter the protocol handler (https, http, ftp, et cetera), just the applicable hostnames.

 

Regards,

 

Aryeh Goretsky

Expand  

Thanks, I figured it out, and successfully blocked a site as a test using 0.0.0.0 instead of the 127.0.0.1

  On 28/04/2019 at 14:07, freqnasty said:

Did you work out why the website was still resolving when you had set it to localhost?

Expand  

Never did figure that out, but I did not spend allot of time messing with it.

There are a bajillion things that could of been reason.

 

Didn't put entries in file correctly

saved the file with ext like .txt

didn't put in the actual fqdn of what the client was using for whatever site trying to block

didn't flush the clients local cache, or even the browsers cache - both of which are different caches

browser was using a proxy (dns and or even local host file not used then)

etc. etc. etc..

  On 28/04/2019 at 16:13, BudMan said:

There are a bajillion things that could of been reason.

 

Didn't put entries in file correctly

saved the file with ext like .txt

didn't put in the actual fqdn of what the client was using for whatever site trying to block

didn't flush the clients local cache, or even the browsers cache - both of which are different caches

browser was using a proxy (dns and or even local host file not used then)

etc. etc. etc..

Expand  

I agree, that is why I did not spend any time to try and figure out the reason it did not work, and it was only for a test purpose anyway, I was not using it for a permanent solution.  

  • 2 months later...
  On 26/04/2019 at 03:37, goretsky said:

Hello,

You need to make sure that you have entered the fully-qualified domain name (FQDN) into the hosts file.  For example, if you wanted to block https://www.example.com/ you would want to enter the following lines into the hosts file:

 

127.0.0.1 example.com
127.0.0.1 www.example.com

Note that you do not enter the protocol handler (https, http, ftp, et cetera), just the applicable hostnames.

 

Regards,

 

Aryeh Goretsky

Expand  

Thanks for this. It helped me out in more ways than I can share. :)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.