How to prevent Hotlink bandwidth theft

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:

  1. Download the nohotlink zip file
  2. Extract (unzip) the files .htaccess and nolink.png from the nohotlink.zip
  3. Open .htaccess using wordpad and change YOURWEBSITE.com to your actual website. For example I would use lancelhoff.com. See the example below:
  4. 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]

  5. Save your changes to the .htaccess file
  6. Now copy the .htaccess file to a directory containing files you want to protect from being hotlinked by other websites
  7. Copy the nolink.png file to your websites root directory.

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:

No Hot Linking Example