lucy24

msg:4307564 | 10:44 pm on May 3, 2011 (gmt 0) |
Quick-and-simple answer: robots arrive with null referrers, so you've already let them in. (My logs confirm this.) The code version you've posted-- hm, looks like you and I swiped from the same source ;)-- points visitors to an alternative image you've created. Mine's intentionally ugly so users will say "Ouch!" and take it down quickly. There are other approaches, especially if bandwidth is an issue. But just replacing your gorgeous multi-megabyte jpg with a little 150x150 16-color png already saves you a bundle. Oh, and the !^$ should probably say !^-?$ to allow for servers (or other in-transit software) that changes empty strings to -. Someone somewhere in these Forums said so.
|
jabz

msg:4307769 | 12:22 pm on May 4, 2011 (gmt 0) |
From what I have learned on this forum, the redirect target should always contain the protocol and domain name. Which leaves us with this:
RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC] RewriteCond %{HTTP_REFERER} !^-?$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://mysite.com/images/hotlink.gif [L] In the RewriteRule, mysite.com can also be external (I guess).
|
mihomes

msg:4308409 | 6:36 pm on May 5, 2011 (gmt 0) |
Thanks... appreciate the responses... I will give this one a try and see how it goes.
|
g1smd

msg:4308420 | 7:08 pm on May 5, 2011 (gmt 0) |
The leading .* at the beginning of the pattern is redundant. A redirect with domain name and using only the [L] flag generates a 302 redirect. I would use RewriteRule \.(jpe?g|gif|bmp|png)$ - [F]
|
jabz

msg:4308438 | 7:58 pm on May 5, 2011 (gmt 0) |
OK, so we either have... RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC] RewriteCond %{HTTP_REFERER} !^-?$ RewriteRule \.(jpe?g|gif|bmp|png)$ [mysite.com...] [NC,R,L] ...in case we want to display another image (make sure not to generate a loop). OR... RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC] RewriteCond %{HTTP_REFERER} !^-?$ RewriteRule \.(jpe?g|gif|bmp|png)$ - [F] ...to thow a 403 Forbidden.
|
g1smd

msg:4308451 | 8:10 pm on May 5, 2011 (gmt 0) |
On its own, the [R] flag generates a 302 redirect.
|
|