.htaccess: stop anti-leech from one referrer only

This is a discussion on .htaccess: stop anti-leech from one referrer only within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I'm trying to redirect a leeching website to an anti-leech image, but no luck. What am I ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-03-2005
Els
 
Posts: n/a
Default .htaccess: stop anti-leech from one referrer only


Hi,

I'm trying to redirect a leeching website to an anti-leech image, but
no luck. What am I doing wrong?

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com/ [NC]
RewriteRule \.jpg$ http://www.mydomain.com/anti-leech.jpg [R,L]

It does stop the original image from being loaded, but in my access
log I see that it keeps trying to load the anti-leech image, but it
keeps serving a 302. It's like an infinite loop for some reason, but
why?

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
  #2 (permalink)  
Old 05-03-2005
Terry
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Els wrote:
> Hi,
>
> I'm trying to redirect a leeching website to an anti-leech image, but
> no luck. What am I doing wrong?
>
> RewriteEngine on
> RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com/ [NC]
> RewriteRule \.jpg$ http://www.mydomain.com/anti-leech.jpg [R,L]
>
> It does stop the original image from being loaded, but in my access
> log I see that it keeps trying to load the anti-leech image, but it
> keeps serving a 302. It's like an infinite loop for some reason, but
> why?
>

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomain\.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jar|jm|php)$ http://www.mydomain.com/anti-leech.jpg
[R,NC]

Works for me - some of these are host dependent (what they have set that
I cannot touch) - I do not understand (yet) what I am doing - basically
cut and paste at this point or throw enough at the wall 'till something
sticks ;-).
--
TK
http://wejuggle2.com/ (not the site this is on)
Still Having a Ball

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #3 (permalink)  
Old 05-03-2005
Els
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Terry wrote:

> Els wrote:
>> Hi,
>>
>> I'm trying to redirect a leeching website to an anti-leech image, but
>> no luck. What am I doing wrong?
>>
>> RewriteEngine on
>> RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com/ [NC]
>> RewriteRule \.jpg$ http://www.mydomain.com/anti-leech.jpg [R,L]
>>
>> It does stop the original image from being loaded, but in my access
>> log I see that it keeps trying to load the anti-leech image, but it
>> keeps serving a 302. It's like an infinite loop for some reason, but
>> why?
>>

> RewriteEngine on
> RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomain\.com(/)?.*$ [NC]
> RewriteCond %{HTTP_REFERER} !^$
> RewriteRule .*\.(jpg|jar|jm|php)$ http://www.mydomain.com/anti-leech.jpg
> [R,NC]
>
> Works for me


Only if you want the anti-leech image to be visible in all cases
except when the referer is somedomain.com. The '!' stands for 'not'.
I wanted the opposite: only block one referrer.

> - some of these are host dependent (what they have set that
> I cannot touch) - I do not understand (yet) what I am doing - basically
> cut and paste at this point


Done that for a 'while' before I posted the message...

> or throw enough at the wall 'till something
> sticks ;-).


That's what I've been doing all evening (GMT+1), and this is what
stuck:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com [NC]
RewriteRule ^(.*)\.jpg anti-leech.jpg [L]

I guess the R (before the L) was keeping it in a loop. Not sure
though. At least it's working now, so I'm happy :-)

> --
> TK
> http://wejuggle2.com/ (not the site this is on)
> Still Having a Ball


Hey, I know you ;-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
  #4 (permalink)  
Old 05-04-2005
Terry
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Els wrote:
> Terry wrote:
>
>
>>Els wrote:
>>
>>>Hi,
>>>
>>>I'm trying to redirect a leeching website to an anti-leech image, but
>>>no luck. What am I doing wrong?
>>>
>>>RewriteEngine on
>>>RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com/ [NC]
>>>RewriteRule \.jpg$ http://www.mydomain.com/anti-leech.jpg [R,L]
>>>
>>>It does stop the original image from being loaded, but in my access
>>>log I see that it keeps trying to load the anti-leech image, but it
>>>keeps serving a 302. It's like an infinite loop for some reason, but
>>>why?
>>>

>>
>>RewriteEngine on
>>RewriteCond %{HTTP_REFERER} !^http://(www\.)?somedomain\.com(/)?.*$ [NC]
>>RewriteCond %{HTTP_REFERER} !^$
>>RewriteRule .*\.(jpg|jar|jm|php)$ http://www.mydomain.com/anti-leech.jpg
>>[R,NC]
>>
>>Works for me

>
>
> Only if you want the anti-leech image to be visible in all cases
> except when the referer is somedomain.com. The '!' stands for 'not'.
> I wanted the opposite: only block one referrer.


Sorry, you are right (as usual!).
I am trying to get anyone using my stuff to give me credit (come in
through the front door) - I do not care if they "steal" my images - they
are so *mine* that they will not do them any real good - they are also
small enough that they are not going to bleed serious bandwidth. The one
thing I am really trying to block is jar file usage and it does not work
on that.

> RewriteEngine on
> RewriteBase /
> RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com {1}[NC]
> RewriteRule ^(.*)\.jpg anti-leech.jpg [L]
>

{1} Don't you need the (/)?.*$ and the other optional stuff?
>>TK
>>http://wejuggle2.com/
>>Still Having a Ball

>
>
> Hey, I know you ;-)
>

Hi, Good lookin' :)

For me this more of a fun puzzle than serious problem.

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #5 (permalink)  
Old 05-04-2005
Els
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Terry wrote:

> I am trying to get anyone using my stuff to give me credit (come in
> through the front door)


Well, with that I can help.
Found this link:
http://www.bylandwaterandair.com/ext...ttribution.php
Works perfectly for me - any of my images that are leeched (and
visited by people who don't block the referrer) are now showing my URL
:-)

> - I do not care if they "steal" my images - they
> are so *mine* that they will not do them any real good - they are also
> small enough that they are not going to bleed serious bandwidth. The one
> thing I am really trying to block is jar file usage and it does not work
> on that.


What is 'jar file usage' ?

>> RewriteEngine on
>> RewriteBase /
>> RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com {1}[NC]
>> RewriteRule ^(.*)\.jpg anti-leech.jpg [L]
>>

> {1} Don't you need the (/)?.*$ and the other optional stuff?


I have no idea really, but apparently not - it's working already :-)

>>>TK
>>>http://wejuggle2.com/
>>>Still Having a Ball

>>
>> Hey, I know you ;-)
>>

> Hi, Good lookin' :)


:-)

> For me this more of a fun puzzle than serious problem.


Same here, but I was quite determined to piss some people off who have
a membership at MySpace - they leech 800x600 and 1024x768 images as
background for their personal pages. It's not causing me to pay more
for my bandwidth, but still - just like to teach them a lesson I
think.

So those get my anti-leech image now, and all the others my URL
slapped on the image :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
  #6 (permalink)  
Old 05-04-2005
Terry
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Els wrote:
> Terry wrote:
>

[snip]
>>- I do not care if they "steal" my images - they
>>are so *mine* that they will not do them any real good - they are also
>>small enough that they are not going to bleed serious bandwidth. The one
>>thing I am really trying to block is jar file usage and it does not work
>>on that.

>
>
> What is 'jar file usage' ?


Java applet - used for a juggling simulator.
>>>RewriteEngine on
>>>RewriteBase /
>>>RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com {1}[NC]
>>>RewriteRule ^(.*)\.jpg anti-leech.jpg [L]
>>>

>>
>>{1} Don't you need the (/)?.*$ and the other optional stuff?

>
>
> I have no idea really, but apparently not - it's working already :-)


If it works - don't fix it!
--
TK
http://wejuggle2.com/

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  #7 (permalink)  
Old 05-04-2005
Jim Hayter
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

On Wed, 4 May 2005 00:32:21 +0200, in alt.apache.configuration, Els
<els.aNOSPAM@tiscali.nl> wrote:

>That's what I've been doing all evening (GMT+1), and this is what
>stuck:
>
>RewriteEngine on
>RewriteBase /
>RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com [NC]
>RewriteRule ^(.*)\.jpg anti-leech.jpg [L]
>
>I guess the R (before the L) was keeping it in a loop. Not sure
>though. At least it's working now, so I'm happy :-)


The R means redirect, so you are sending the new URL back to the
browser and telling it to use it instead. When it hit your original
rewrite rules, it would get rewritten to itself - infinite loop.

HTH,
Jim
  #8 (permalink)  
Old 05-04-2005
Els
 
Posts: n/a
Default Re: .htaccess: stop anti-leech from one referrer only

Jim Hayter wrote:

> On Wed, 4 May 2005 00:32:21 +0200, in alt.apache.configuration, Els
> <els.aNOSPAM@tiscali.nl> wrote:
>
>>That's what I've been doing all evening (GMT+1), and this is what
>>stuck:
>>
>>RewriteEngine on
>>RewriteBase /
>>RewriteCond %{HTTP_REFERER} ^http://www.somedomain.com [NC]
>>RewriteRule ^(.*)\.jpg anti-leech.jpg [L]
>>
>>I guess the R (before the L) was keeping it in a loop. Not sure
>>though. At least it's working now, so I'm happy :-)

>
> The R means redirect, so you are sending the new URL back to the
> browser and telling it to use it instead. When it hit your original
> rewrite rules, it would get rewritten to itself - infinite loop.


Thanks, I'll remember that :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 


Thread Tools
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:51 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0