Welcome to WebmasterWorld Guest from 54.205.209.95

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Is it possible to block hotlinking by an ip address?

   
7:51 am on Nov 28, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I have an issue with a particular bot that what it does is steal our images on the fly for several hundred websites that just happen to be competitors of ours.

I can block by the domain names, but what I'd really like to do is if this particular ip address or user agent comes along to only serve up another image file.

176.9.31.xx

What I have been doing so far is to just block the ip addresses, but the number of sites this bot is "working for" is growing exponentially. I'd like to server them up an ad to come to our site LOL.

Here's what I have set up, but I need to block this with it's ip address or useragent since the domains change...

QippoBot is the user agent.

RewriteCond %{HTTP_REFERER} ^http://(www\.)?example\.com(/.*)*$ [NC]
RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF)$ /hotlink.png [L]
10:02 am on Nov 28, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Bookmark this page:

[httpd.apache.org...]

The variable you want is called REMOTE_ADDR, as in:

RewriteCond %{REMOTE_ADDR} ^123\.456\.789 [NC]
RewriteRule \.(jpe?g|gif|png)$ /hotlink.png [L,NC]

But remember that you only need to list those extensions that you actually use, unless you've got one of those case-insensitive servers. Do you really have image files named .jpg AND .JPG AND .jpe AND .jpeg and so on...?

CIDR ranges aren't very kind to Regular Expressions-- or vice versa-- so you may want to fudge it. For example if the offender lives at 12.12.32.0/20 just say
^12\.12\.[34]\d\.
without closing anchor, and to heck with anyone at 12.12.30.nn and .31.nn, or .48.nn and .49.nn. Unless they are particular friends of yours.
3:26 am on Nov 29, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Yea, I don't use .png files on our site.

Unfortunately some of the sales reps load files and yea the case and file types can be different. I generally clean it up a few times a year.

Thanks for the help Lucy!