Thwart hotlinkers with a replacement image
I found that using mod_rewrite to send an error 403 Forbidden code to web sites that attempt to link to my images isn’t that effective. The image will appear is a blank box in Internet Explorer which the casual surfer can right click on, copy the image location, paste it into their address bar and see the final image.
My new method for preventing hotlinking that I’ve installed on Webspiffy is much more effective because instead of serving up no image at all, it serves up a replacement image that draws attention to itself. This is good because the webmaster of an infringing site will remove the hotlinked image just to get rid of my replacement image. Of course, you can be as creative as you want with a replacement image, such as using a gigantic porn picture, but I like to keep it low key. I just serve up an image that says, This image is stolen!. Simple and effective.
My anti-hotlinking code now looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !stolen\.gif$
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain\.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://yourdomain\.com/images/stolen\.gif [R,L]
The replacement image should be saved to /images/stolen.gif relative to the web root. Feel free to use any image you want for the replacement image! If you use this code, please post a comment with an example. I love to see what people come up with. Enjoy!
1 comment
I’m such an egotist that beyond being happy when someone reads my site, I’d be happy if someone stole my images. Plus I have plenty (25 gigs a month) of data transfer. Good idea, though.