[solved] hosts file

January 23rd, 2020

how do you block a subdomain with hosts file? i tried and it doesnt work. i know how to block domain ex www.domainhere.com and if i put in hosts file 127.0.0.1 domainhere.com it works and it blocks this domain. but if i try 127.0.0.1 domainhere.com/subdomain it does not work to block this subdomain.
so can anyone help me?

Answer #1
check out some php scripts to password protect it, u can find some pretty secure ones
Answer #2
Hosts files doesn’t work that way. You can only block whole hosts now block a subdomain or etc unless the domain is hosted on another server
Answer #3

^|^ wrote: Select all

Hosts files doesn’t work that way. You can only block whole hosts now block a subdomain or etc unless the domain is hosted on another server
what to do for blocking subdomain?
lets say i am home and want to block website subdomain from being accessed? like website.com would be fine but i want to block website.com/subdomain from being accessed on my browser. is that still impossible? i dont want to use 3rd party software, but if i must then it shall be.
Answer #4
, website.com/subdomain it’s not a subdomain of website.com. That’s just a folder inside the root of website.com (called subdomain).
A subdomain would be something like mail.website.com, and this you also may block\redirect through the hosts file.
Just a particular page or folder on the web server (like website.com/aaa/, you just can’t block through this process.
Answer #5
, website.com/subdomain it's not a subdomain of website.com. That's just a folder inside the root of website.com (called subdomain).
A subdomain would be something like mail.website.com, and this you also may block\redirect through the hosts file.
Just a particular page or folder on the web server (like website.com/aaa/, you just can't block through this process.

would i be able to block a specific page without also blocking the domain?
for example, and im simply using this as just a specific example for this question:
http://www.hbo.com/sports/index.shtml how do i block this page without also blocking the domain? essentially i want to know how to block a page without also blocking the domain. it seems as the best way to block a specific web page is to block out the whole domain
Answer #6
You can do that if you have a good firewall
Answer #7
^|^ exactly.
In an home environment (where typically you don’t have a server function as a dedicated firewall\gateway), the easiest way would be to use a good firewall.
I’m a fan of ESET’s solutions, so I will use ESET Smart Security as the example (although there are innumerous firewalls that include this functionality). For Smart Security you may find here instructions:
http://training.eset.com/kb/index.php?option=com_kb&Itemid=29&page=articles&articleid=140
Instead of www.example.com, just create a rule to block the url www.hbo.com/sports/ and www.hbo.com/sports/* if you wish to block all pages\folders under the folder sports.