Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-03-28, 12:42 AM   #1
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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...?
Jel is offline   Reply With Quote
Old 2006-03-28, 03:32 AM   #2
xxxtreme
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..
xxxtreme is offline   Reply With Quote
Old 2006-03-28, 10:34 AM   #3
cd34
a.k.a. Sparky
 
cd34's Avatar
 
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
cd34 is offline   Reply With Quote
Old 2006-03-29, 02:03 AM   #4
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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
Jel is offline   Reply With Quote
Old 2006-03-29, 02:13 AM   #5
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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..
Jel is offline   Reply With Quote
Old 2006-04-11, 04:02 PM   #6
stuveltje
Live and learn. And take very careful notes!
 
stuveltje's Avatar
 
Join Date: Apr 2003
Location: Sunny Holland
Posts: 6,157
Send a message via ICQ to stuveltje
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..
stuveltje is offline   Reply With Quote
Old 2006-04-29, 01:45 AM   #7
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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
Jel is offline   Reply With Quote
Old 2006-04-29, 01:56 AM   #8
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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]
Jel is offline   Reply With Quote
Old 2006-04-29, 03:09 AM   #9
Maj. Stress
Progress rarely comes in buckets, it normally comes in teaspoons
 
Maj. Stress's Avatar
 
Join Date: Jun 2005
Location: Dark Side Of Naboo
Posts: 1,289
clear your cache?
Maj. Stress is offline   Reply With Quote
Old 2006-04-29, 06:05 AM   #10
cd34
a.k.a. Sparky
 
cd34's Avatar
 
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
cd34 is offline   Reply With Quote
Old 2006-04-30, 02:14 AM   #11
Jel
I'm the only guy in the world who has to wake up to have a nightmare
 
Jel's Avatar
 
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
Jel is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:42 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc