Auto-HotLink
I slipped a new script up the org last week, and have made a few minor edits since. It's called "Auto-HotLink", and the more I think about it and see it running here, the more I think it's an important script.CONSIDER THIS..
Though a hot-linked1 image is bandwidth-theft, it does present us with an unusual opportunity - that of being able to alter the content of other web sites.
Think about it; by using a dynamic, generated hot-link image, you can take control of THEIR content, and change what THEIR visitors see, even what they read. At least until the offending webmaster sees the error of his ways, something which often takes an astoundingly long time.2
By using a dynamic image, with the potential to overlay text or whateveryoulike onto that image, you can transform this bandwidth theft into instant compensation; a dynamically generated advert for your web site. How often does someone offer you free advertising space?
Sending these requests to /null or 403, or a daft "NO HOT-LINKING" image, is a crazy, wasted opportunity. Even the image that reads "NO HOT-LINKING", has, of course, been hot-linked. Doh! We want the joke to be on THEM!
Auto-HotLink enables you to make the most of this opportunity. You can import logos and other images, or generate images from scratch, and then overlay text onto that, and spit it out as png or jpeg. Keep their readers up-to-date with your latest promotions! Auto-Hotlink finishes up by logging the offending hit, so you know exactly who's stealing (advertising) what.
It's all quite basic, and there's nothing much to it. Like most of my web-site spare parts™, it does a simple task, and does it well, and is free. You can set a few preferences and what-not, to control the output, and that's about it. Installation and usage instructions are included in the script, as ever. Basically, you use mod_rewrite to redirect hits for images from other sites, and auto-hotlink does the rest, something like (in your site's main .htaccess file)..
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?your-domain\. [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(.+)\.google\. [NC] RewriteRule ^(.*)\.(gif|jpe?g|png)$ http://%{HTTP_HOST}/path/to/hotlink.php?url=$1.$2 [R,NC,L]
The ?url=$1.$2 part is optional, and enables us to log exactly what resource they were trying to snatch. Later I might later use this information to allow "good" referrers to pass-through to the real file; until then mod_rewrite lets through a chosen few. More mod_rewrite info on " that bloody rewrite page".
So there you have it. If the idea of free; albeit sometimes dubiously-placed; advertising interests you, or you're simply tired of having your bandwidth stolen, this might be just what you are looking for. Even without the script, it is a neat idea; using your domain name as a hot-link image; something I shared on the above .htaccess pages a while back and have been meaning to develop further. I'll likely add something there, too. Or better yet, a link back to here.
Previous to Auto-HotLink, I used a wee "corz.org" logo, did the job well enough; an advert for the site. But having a simple framework to lay text on this image and alter that text on a whim, is going to be handy for future promotions, no doubt. For now, it simply reads..
we love corz.org!
Well, dontcha?;o)
p.s. I'm working on a clutch of admin scripts (or rather, working on making them fit-for-public); if you have a DIY kinda site, particularly one that uses plog files, and fancy previewing (read: beta-testing) these, let me know.
references:
1. In case you don't know; a "hot-link" is when some webmasta, instead of *gasp* creating their own graphics, or even downloading and stealing yours, links directly to the image on your server! Not just design theft, but bandwidth theft, to boot! Wherever possible, genuine webmasters like to prevent this sort of thing.
2. This is partly to do with people being essentially lazy, and partly to do with browser caching. What's so amusing for webmasters who have their images stolen (my HUGE PayPal logo is currently a favourite, along with my rss logo (which is medoicre by any measurement) and Batch-Runner logo (this one, admittedly, is so good that I have more than once caught myself just gazing at it)), is that the scoundrel has no clue whatsoever that his theft has been effectively thwarted.
When he visited your site, his browser stored your lovely image in its cache, and there it remains, sometimes for a very long time. Mr. Hot-linker slaps the image onto his site, loads the page and sees the thing in all its glory. All his other visitors, of course, see your hot-link image, and may or may not think anything of it, except, of course again, your tld is now imprinted in their mind. Mission accomplished.
Sometimes they do spot it, and on more than one occasion I have been openly accused of "Hacking" web sites, which is double-plus amusing when they realize what really happened and have to openly wipe egg off their face. Ho-hum.
2. This is partly to do with people being essentially lazy, and partly to do with browser caching. What's so amusing for webmasters who have their images stolen (my HUGE PayPal logo is currently a favourite, along with my rss logo (which is medoicre by any measurement) and Batch-Runner logo (this one, admittedly, is so good that I have more than once caught myself just gazing at it)), is that the scoundrel has no clue whatsoever that his theft has been effectively thwarted.
When he visited your site, his browser stored your lovely image in its cache, and there it remains, sometimes for a very long time. Mr. Hot-linker slaps the image onto his site, loads the page and sees the thing in all its glory. All his other visitors, of course, see your hot-link image, and may or may not think anything of it, except, of course again, your tld is now imprinted in their mind. Mission accomplished.
Sometimes they do spot it, and on more than one occasion I have been openly accused of "Hacking" web sites, which is double-plus amusing when they realize what really happened and have to openly wipe egg off their face. Ho-hum.