Hot Linking to images


What is hot linking?

Hot Linking is when a site uses images (or other media such as videos) from another site by directly linking to the image on the other site.
This might be undesirable since every visit will result in bandwidth usage of the other site.

<img src="https://httpsecurityheaders.applephi.net/images/adapterpattern.jpg" />

Preventing hotlinking

You can prevent sites from hot linking to your media by checking the REFERER header.
A browser will, when downloading data from another source, send along a REFERER header with the site that is using the media. So if another site is downloading media from your server, the url in the REFERER header won't match. In case case your server could simply return an error, or return other media.

Demo

All media from this site are protected by this method.
Try hotlinking to this image


© 2017 - Peter Himschoot