July 16, 2004

Prevent hotlinking

Thomas Scott, writing in A List Apart, proposes a clever way to block bandwidth theft, aka HotLinking.

...if someone tries to hotlink one of your images, it’ll fail — the browser, instead of receiving an image file, will receive the result of showpic.php , which is sent as text/html . It’ll realise it can’t display it, and produce a broken image placeholder. Bandwidth saved.

On the other hand, if someone tries to link directly to your images, they’ll get silently redirected to an HTML page with your credit on it! No red X, no silly “denied” image — just a handy page that shows them the image they want to see, and gives you credit for your work.

I wonder if this could be reworked to protect videos from hotlinking? I bet it could.

Posted by jackhodgson at July 16, 2004 01:04 PM