LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to block some parts of a website through /etc/hosts? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-block-some-parts-of-a-website-through-etc-hosts-944349/)

TheIndependentAquarius 05-11-2012 12:34 AM

How to block some parts of a website through /etc/hosts?
 
For example if a website has 10 sections,
I'd like to block 3 of them, only.

System admins here aren't willing to help in
this case. So, is there a way to do this through
/etc/hosts etc.?

em31amit 05-11-2012 12:45 AM

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


for eg:

Code:

cat /etc/hosts

 127.0.0.1        www.google.com 
 127.0.0.1        www.facebook.com
 127.0.0.1        abc.test.com

so if browser query for dns name, it will get a loopback IP, and try to open it. hence websites will not open

TheIndependentAquarius 05-11-2012 12:48 AM

For "example", LQ has sub forums, and if I'd like
to block 5 particular sub forums out of 10, then
what am I supposed to do?

Slackyman 05-11-2012 01:01 AM

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.

em31amit 05-11-2012 01:02 AM

Code:

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


Slackyman 05-11-2012 01:05 AM

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.

TheIndependentAquarius 05-11-2012 01:09 AM

Quote:

Originally Posted by em31amit (Post 4675669)
... iso.linuxquestions.org ... jobs.linuxquestions.org

Actually this worked, but I was talking about
sections like newbie, software, /General etc.

Quote:

Originally Posted by Slackyman (Post 4675668)
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.

Alright, will read upon those things.
Thanks.

ukiuki 07-26-2012 01:33 PM

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:
Code:

127.0.0.1 doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 ad.ca.doubleclick.net
127.0.0.1 adremote.timeinc.net
127.0.0.1 adsremote.scripps.net
127.0.0.1 a.as-us.falkag.net
127.0.0.1 interclick.com
127.0.0.1 a1.interclick.com
127.0.0.1 media.fastclick.net
127.0.0.1 network.realmedia.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 ad.ad-flow.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 ad.bannerconnect.net
127.0.0.1 ww57.smartadserver.com
127.0.0.1 www3.smartadserver.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 ad2.netshelter.net
127.0.0.1 a.collective-media.net
127.0.0.1 ad.103092804.com
127.0.0.1 ad.adperium.com
127.0.0.1 ad.yieldmanager.com
127.0.0.1 ads.youporn.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 ads.justrelevant.com
127.0.0.1 ads.associatedcontent.com
127.0.0.1 ads.blogtalkradio.com
127.0.0.1 ads.fulldls.com
127.0.0.1 adserver.adreactor.com
127.0.0.1 adserver.zwame.pt
127.0.0.1 ads2.globo.com
127.0.0.1 adserv.legitreviews.com
127.0.0.1 adsrv.deviantart.com
127.0.0.1 ads.cnn.com
127.0.0.1 ad.zanox.com
127.0.0.1 ad.kickasstorrents.com
127.0.0.1 at-adserver.alltop.com
127.0.0.1 ads.trackitdown.net
127.0.0.1 cdn1.ads.contentabc.com
127.0.0.1 ads.crakmedia.com
127.0.0.1 data.ero-advertising.com
127.0.0.1 ads.trafficjunky.net
127.0.0.1 media.trafficjunky.net
127.0.0.1 media.adxpansion.com
127.0.0.1 a.tribalfusion.com
127.0.0.1 cs.adxpansion.com
127.0.0.1 ifa.camads.net
127.0.0.1 clickserv2.sitescout.com
127.0.0.1 infinityads.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 ads.ad4game.com
127.0.0.1 ads.adk2.com
127.0.0.1 ads.dothads.com
127.0.0.1 ads.e-planning.net
127.0.0.1 ads.pixfuture.net
127.0.0.1 ads.pubmatic.com
127.0.0.1 ads.supplyframe.com
127.0.0.1 ads.undertone.com
127.0.0.1 adsearch.adkontekst.pl
127.0.0.1 ads.cpxcenter.com
127.0.0.1 ads.lzjl.com
127.0.0.1 ads.pointroll.com
127.0.0.1 adserver.adtechus.com
127.0.0.1 adshuffle.com
127.0.0.1 adsrvr.org
127.0.0.1 adtech.de
127.0.0.1 advertising.com
127.0.0.1 adxpose.com
127.0.0.1 ero-advertising.com
127.0.0.1 d.adsbyisocket.com
127.0.0.1 ad.adserver01.de
127.0.0.1 ib.adnxs.com
127.0.0.1 d.afdads.com
127.0.0.1 click.adbrite.com
127.0.0.1 this.content.served.by.adshuffle.com
127.0.0.1 br.betclic.com
127.0.0.1 ib.adnxs.com
127.0.0.1 v2.afilio.com.br
127.0.0.1 pixel.mathtag.com
127.0.0.1 stats.sellbuyads.com
127.0.0.1 stats.buysellads.com
127.0.0.1 s3.buysellads.com
127.0.0.1 dspads.sitescout.netdna-cdn.com

Regards


All times are GMT -5. The time now is 03:46 AM.