|
2006-03-28, 12:42 AM | #1 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
Block certain domains via htacess
Hi Guys,
This musta been asked before but I can't track the answer down using the search function, apologies. I have a few domains sending me worthless traffic to galleries they have picked up from TGP's and I want to block their traffic. I googled and got: order allow,deny deny from .domain.com deny from .domain.com deny from .domain.dk allow from all which didn't work, so I tried: order allow,deny allow from all deny from .domain.com deny from .domain.com deny from .domain.dk but no dice there either - wrong instructions, or dumb mistake somewhere? Thanks in advance btw what should I be seeing when I click a link from those place - 403 forbidden or...? |
2006-03-28, 03:32 AM | #2 |
A woman is like beer. They look good, they smell good, and you'd step over your own mother just to get one!
Join Date: Mar 2004
Posts: 51
|
You could try something like this:
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?domain1.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?domain2.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?domain3.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?domain4.com.*$ [NC] RewriteRule .* http://www.google.com [R,L] Does a great job on my sites Btw, I got this from: http://www.htaccesstools.com/block-hitbots/ Last edited by xxxtreme; 2006-03-28 at 03:35 AM.. |
2006-03-28, 10:34 AM | #3 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
the reason your earlier rules didn't work is that you were blocking the 'host' machine of domain.com from accessing your site. So, had their webserver tried to hit your server, they would have been blocked. This wasn't what you wanted.
In addition, by putting deny from domain.com in your .htaccess, you now forced apache to do a DNS lookup for EVERY request below that .htaccess -- that reverse dns lookup can really slow things down on a busy site. The Rewrite Rules posted by xxxtreme look at the referrer as sent by the surfer's browser. I would suspect that is what you were really after. if indeed it is a hitbot and not some form of hotlinking or unwanted traffic, your first rules would be correct, however, based on your test and stated results, I think you wanted to block the referrer, not the server.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
2006-03-29, 02:03 AM | #4 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
Thanks guys,
Took me a couple of reads but I think I got it. It's german and some other unproductive foreign traffic from foreign TGPs, so I'm gonna use your rules xxxtreme |
2006-03-29, 02:13 AM | #5 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
Hmm, can't get this to work - I have:
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?fatfred.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?i5sex.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?gratis6.dk.*$ [NC] RewriteRule .* google.com [L] But can still get to my galleries from their pages. *edited to add: Just noticed the code I was generated differed slightly to the example posted by xxxtreme so I made it [R,L] on the bottom line, but that hasn't cured it, so I'm stuck lol. Last edited by Jel; 2006-03-29 at 02:15 AM.. |
2006-04-11, 04:02 PM | #6 |
Live and learn. And take very careful notes!
|
i use this to redirect sites i dont wanna have traffic from
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://fusker.lewww.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://babes.coolios.net/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://fusker.org/.*$ [NC] RewriteRule \.(jpg|gif)$ http://www.some of your sponsor paysites or 404.com/ [R,L,NC] most of the time i put in the last domain a paysite url that way i dont burn the bandwidth, i had to do it last time with some japanese tpg linksite who linked one of my squirting galleries Last edited by stuveltje; 2006-04-11 at 04:09 PM.. |
2006-04-29, 01:45 AM | #7 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
aaargh this is driving me crackers lol, ok here is what I have,
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://fode-me.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://fatfred.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://gratis6.dk/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://5isex.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://i5sex.com/.*$ [NC] RewriteRule \.(jpg|gif)$ http://www.google.com/ [R,L,NC] But when I check the links on those pages I get taken to my domain, not google - I'm stumped |
2006-04-29, 01:56 AM | #8 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
So I changed the last line thinking the gif|jpg rule may be referring to hotlinking, this is now what I have, and still does not work:
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://fatfred.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://fode-me/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://5isex.com/.*$ [NC] RewriteRule .* http://www.google.com [R,L] |
2006-04-29, 03:09 AM | #9 |
Progress rarely comes in buckets, it normally comes in teaspoons
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
|
clear your cache?
|
2006-04-29, 06:05 AM | #10 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(.*\.)?fatfred.com [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(.*\.)?fode-me [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(.*\.)?5isex.com [NC] RewriteRule .* http://www.google.com [R,L] you would have blocked http://fatfred.com from linking to you, but not http://www.fatfred.com. you can also do something like: RewriteEngine on RewriteCond %{HTTP_REFERER} fatfred.com [NC,OR] RewriteCond %{HTTP_REFERER} fode-me [NC,OR] RewriteCond %{HTTP_REFERER} 5isex.com [NC] RewriteRule .* http://www.google.com [R,L] which will block www.123fode-me234.com
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
2006-04-30, 02:14 AM | #11 |
I'm the only guy in the world who has to wake up to have a nightmare
Join Date: Feb 2004
Location: London, United Kingdom
Posts: 1,895
|
No idea why it won't work still, tried that new rule sparky, still no joy. Wasted too much time on this so I'm gonna forget about it. Thanks for all your time people
|
|
|