Forum Moderators: phranque
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.mysite.com/.*$ [NC]
RewriteRule .*\.(gif¦jpg)$ - [N,F,L]
I've tried to change the RewriteRule several different ways to use a specific image instead of the blank image line, most commonly variations of:
RewriteRule \.(gif¦jpg)$ [mysite.com...] [R,L]
However, this doesn't work. After changing this, I found that people could still view my image (I did clear my cache).
Any suggestions? I do have mod_rewrite.
Also, if I wanted to change this script to allow one folder from my site to be directly linked (I'll need to do so for ebay auctions), does anyone have a suggestions?
Thanks for any help.
I set my site up to block image linking when I realised some forum junkie was using four in his sig! Took me a fair while to get it working correctly but here it is:
-------------------------------------------
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$ [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain.co.uk.*$ [NC]
RewriteRule \.(gif¦jpg¦png)$ [mydomain.co.uk...] [R,L]
-------------------------------------------
Hope that helps
There was (another) forum whose member added an image that was a 200px square stating "This is a Stolen Image."
Obviously, the image was still draining bandwidth, but it certainly got the point across: Don't Steal My Images! [and made the member look like an idiot].
Apparently any image located at a different address is swapped with the alternate image. Interesting trick.
For my site I just made up a quick banner ad with my url and some graphics to gain a little free exposure in return for the bandwidth taken. Fair trade IMHO.
I post on some photography forums and someone else who also does found some people stealing his images ..
He pointed his camera down a toilet and took an image of what he found there.
Then he used this code to serve that image whenever anyone off his domain requested images from his server ..
When I saw them in the forum where I post .. (where he had posted his own images) I wrote .. w-t-f are you doing ..
Ooops came the embarrased reply I forgot about my own postings of images .. better change that immediately :-)
You can selectively redirect I am pretty sure
so either only offenders image requests are changed ..
or .. you permit yourself to post your images on particular domains ..
Anyhow his linked image was not nice ..
Hope it amuses :-)
Fixing up your code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com [NC]
RewriteRule \.(gif¦jpg)$ - [NC,F]
Jim
I think that the pipe code bit helped me figure out part of the problem (the main one was that the .htaccess code was actually blocking the image I wanted to change it with as well as the others, which was really stupid of me).
Now to experiment with a .htaccess blank referrer to see if using just that will override the .htaccess the folder above ...
Just be aware that many legitimate users will have a blank referrer - that is why it's allowed in most of the code you see here. Any user who comes through an ISP or corporate proxy, or who uses Norton Internet Security may have a blank referrer. You'll have to decide whether losing them is worth the cost of blocking blank referrers.