So you’ve got your blog all set up, you’ve been publishing for a while, and all of a sudden you learn that people have been “hotlinking” to your images. This outrages you, so you set up an .htaccess rule to replace any “hotlinked” images with a graphic that says “Stealing Images Makes You A Jerk!”
That ought to teach those jerks for stealing your images… right? Sure it will, but I’ve got a question for you: Do you have an RSS feed?
Oh, you do?
Well, you’ve also just prevented all those “jerks” who subscribe to your feed from “stealing” your images too. Wait, you want them to be able to see your images? Of course you do.
The trick is to set up your .htaccess file to allow certain websites to be able to display your images, while blocking everyone else. You’d do it by making your .htaccess file look something like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.*)?livejournal.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?google.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?bloglines.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?newsgator.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?yahoo.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?rojo.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?newsburst.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?pluck.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?aol.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?msn.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?ixquick.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*)?skweezer.*$ [NC]
RewriteRule /images/(.*).(jpg|jpeg|png|gif|bmp) /images/DoNotSteal.png [NC]
What that does is look to see if your image is being loaded from some other website. If it is it then checks to see if that website is one of the “approved” ones. If the site in question is in the list, the image is displayed normally—but if it’s not, your “Do Not Steal” graphic gets displayed instead.
That list is all of the online RSS aggregators I know of. If you want to add your friend’s site to your approved list, just copy one of the lines up there, substituting in the proper domain name. Don’t include the “www,” because that little ”(.*)?” will match that if it’s there.
If you use a reader that’s not in that list, let me know so I can update the list here.