How to prevent Hotlink bandwidth theft

Hotlink protection prevents other websites from embedding or directly linking to images, videos, or media files served from the owner's site. This practice can be considered bandwidth theft because the images displayed on the page are hosted remotely on the owner's site. When visitors arrive to view the page, the remote host must fetch the images for display, consuming additional bandwidth, resources, and processing power from the owner's site.

What is Hotlinking?

Hotlinking, also known as inline linking or direct linking, is a practice where one website embeds images, videos, or other media content hosted on another website by directly linking to the source URL of that content. Instead of hosting the media files on their own server, the website steals the bandwidth and resources of the original host by displaying the linked content on their own pages. This can lead to increased server load and bandwidth usage for the original host without any benefit or credit given to them. Many website owners employ measures to prevent hotlinking, such as using .htaccess rules or specialized plugins, to protect their content and resources.

In the following simple solution, I cover one way a site owner can protect their images and files from being hot linked to help prevent bandwidth theft and inform the person linking to the image to store the image or photo on their own server.

no hotlink protection

Setting up hotlink protection to prevent bandwidth theft on your site:

  1. Download file which is a zipped archive.
  2. Extract (unzip) the files .htaccess and nolink.png from the zipped file.
  3. Open .htaccess using wordpad and change to your actual website.
    For example, here I would use as seen below:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?*$ [NC]
    RewriteRule \.(jpg|jpeg|png|gif|zip|rar)$ /nolink.png [R,L]
  4. Save your changes to the .htaccess file
  5. Now copy the .htaccess file to a directory containing files you want to protect from being hotlinked by other websites
  6. Copy the nolink.png file to your websites root directory.

That's all there is to 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 while informing the person linking to the image to store a copy on their own server, instead.