Forum Moderators: phranque

Message Too Old, No Replies

Hot linking protection only for some domains

The top 5 violators would cover 90% of hot linking

         

jetteroheller

4:42 pm on Oct 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just discovered, that ony of my domains used last month about 5 GB for hot linked pictures.

Most violators are 5 domains´

Now I would like to redirect all with referers from this 5 domains accessing a jpg to an do-not-copy.png

But I did not find an example for exactly this.
Please could somebody help?

jdMorgan

5:28 pm on Oct 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Adding

RewriteCond %{HTTP_REFERER} ^http://www\.hotlinker1\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.hotlinker2\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.hotlinker3\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.hotlinker4\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.hotlinker5\.com [NC]

ahead of the 'standard' code will make that code execute only if the referrer is one of those unwelcome sites. Note that most media players do not provide a referrer, so this may not work if you are trying to stop media-file hotlinking. If you're just trying to stop image hotlinking, where the images are loaded by the browser (not a media player), this should work fine.

Jim

jetteroheller

6:34 pm on Oct 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But where is in the code, that only jpg are not allowe to link to

Where is the target to write?

jetteroheller

7:15 pm on Oct 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Also one of the violators has many different subdomains.

How to match only with the domain name?

jdMorgan

5:22 pm on Oct 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




# block any/all hotlinker1 subdomains
RewriteCond %{HTTP_REFERER} ^http://([^./]*\.)*hotlinker1\.com [NC,OR]
...
# block hotlinker5 domain and www subdomain
RewriteCond %{HTTP_REFERER} ^http://(www\.)?hotlinker5\.com [NC]
# return 403-Forbidden response to hotlink requests for .jpg files
RewriteRule \.jpg$ - [F]

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim