[SOLVED] How to block some parts of a website through /etc/hosts?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
well, if that websites have different subdomain and different IP address for that domain, that you can make a wrong IP entry to those domain into /etc/hosts. that can work
You can't with /etc/hosts since it accepts only domains and ip addresses so you'll end up to block entire sites, not oly some pages.
For this purpose you use aproxy like squid and configure its policies.
cat /etc/hosts
ACTUAL IP www.linuxquestions.org
127.0.0.1 iso.linuxquestions.org #want to block so user can't download heavy iso files
127.0.0.1 jobs.linuxquestions.org #NO more job search here
If the url you want to block is an entire domain (even third level domain) it's ok and you can use /etc/hosts like you shown, but if you want to block a specific page or url like www.linuxquestions.org/reviews/ you have to find another way.
Actually this worked, but I was talking about
sections like newbie, software, /General etc.
Quote:
Originally Posted by Slackyman
You can't with /etc/hosts since it accepts only domains and ip addresses so you'll end up to block entire sites, not oly some pages.
For this purpose you use aproxy like squid and configure its policies.
Here you will find more info about how and why to block sites: http://pgl.yoyo.org/as/
I believe the 1st reason is the ads that come with most pages now days and it does require extra bandwidth to browse, it may effect more those who don't have fast connection, in any case to block ads is the one thing that concerns people more.
Personally I do hate ads, side, top, botton banners blinking only serve to distract. I do never ever click on them, so why not to block them.
Here my list of blocks:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.