Hotlink protection of web site images and files: What is Hotlinking? Hotlinking is when a web site is linking directly to images, video's or other files that are served from another site. Hotlinking can be considered bandwidth theft, because images served on the page are remotely hosted on the owners page. As visitors arrive to view the page, the remote host has to conjour up the images for viewing which consumes additional bandwidth of the image owners site. In the following, I cover one way a site owner can protect their images and files from being hotlinked to help prevent bandwidth theft.
How to prevent Hotlink bandwidth theft:
Hotlink Protection:
- Download the nohotlink zip file
- Extract (unzip) the files .htaccess and nolink.png from the nohotlink.zip
- Open .htaccess using wordpad and change YOURWEBSITE.com to your actual website. For example I would use lancelhoff.com. See the example below:
- Save your changes to the .htaccess file
- Now copy the .htaccess file to a directory containing files you want to protect from being hotlinked by other websites
- Copy the nolink.png file to your websites root directory.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lancelhoff.com/.*$ [NC]
RewriteRule \.(jpg|jpeg|png|gif|zip|rar)$ /nolink.png [R,L]
That's it, now when a site owner tries to hotlink to your images, the image will be replaced by the nolink.png, helping to prevent bandwidth theft.
See example "No Hot Link" Image below: