I want the hosts file to block www.url.com/page without blocking www.url.com
step 1
//////////////
I've added 127.0.0.1 www.apple.com
to my /etc/host
file
When I do ping www.apple.com
I get this desired result:
64 bytes from localhost (127.0.0.1):
When I try to access www.apple.com in the browser, it gives me the desired error and I cannot access the site www.apple.com
So there is no problem with my browsers cache.
step 2
////////////////////
Next Ive added /itunes/
to the line above which makes 127.0.0.1 www.apple.com/itunes/
When I do ping www.apple.com/itunes/
I get the desired result
64 bytes from localhost (127.0.0.1):
BUT!!!! When I type www.apple.com/itunes
into my browser I am able to connect to apple's itunes site, which is not expected. Writing 127.0.0.1 www.apple.com/itunes/
in my /etc/hosts file should send me to 127.0.0.1 when I type www.apple.com/itunes/
in my browser
conclusion
////////////////
the /etc/hosts file is ignoring suburls like /itunes/ or /ipod/ but works completely fine with domains such as www.apple.com
Why is 127.0.0.1 www.apple.com/itunes/
causing the desired result and 127.0.0.1 www.apple.com
not causing the desired result?
Don't tell me browser cache because127.0.0.1 www.apple.com
causes the desired result.
UPDATE I have since found out that it is impossible to do what I am trying to do with the hosts file.
The /etc/hosts file can only redirect domains and con not direct pages inside those domains.
answer solved. thank you.