in MT.Net, X-Geek

Keep people from linking to your images

The IRS scam email below links to the IRS logo, on the IRS website itself! The government could avoid having its own bandwidth used for scams by adding some rewrite rules in Apache.

When I saw some of my photos being linked from other websites (usually forum-type sites that don’t provide their users the ability to upload their own files), I decided I didn’t want to foot the bill to host images shown on other websites. I followed this great tutorial and implemented my own RewriteRules, which have worked like a charm:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !no-direct-links\.png [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?markturner\.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?planettrilug\.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) http://www.markturner.net/wp-content/no-direct-links.png [R,NC,L]

These rules allow images to appear on my website, the PlanetTrilug website, and Google’s image searches, but any other sites linking directly to my images get a “No Direct Links” image instead.

I am pretty easygoing with the use of my images (many of them donated to the public domain), but hosting them for other sites costs me money. If you would like to post one of my images on your website, if it’s a public domain (or Creative Commons) one feel free! If it is not, shoot me an email and let me know your plans. Whatever you do, though, please use your own server. Don’t link directly to my images. Thanks!

  1. I pay for outgoing bandwidth above a certain limit, and if someone is linking to a 1 MB image the bandwidth add up quickly. Particularly if my image gets linked on a popular web forum, which has been the case for the past few days.

    If someone wants to link to one of my blog posts which includes an image, I’m cool with that. But to point to my image alone with none of my context, and to do it from a members-only forum where I cannot see how it is being used (nor can I politely ask for it to stop, if desired) is just not cool.

  2. Thanks very much for letting us show your images on Planet TriLUG. Out of curiosity, do you google rules also include images shown on Google Reader? I actually read Planet TriLUG directly from Google Reader which is why I ask.

Comments are closed.