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.
Preventing Hotlink bandwidth theft
Setting up hotlink protection to prevent bandwidth theft on your site:
- Download nohotlink.zip file which is a zipped archive.
- Extract (unzip) the files .htaccess and nolink.webp from the zipped file.
- Open .htaccess using wordpad and change YOURWEBSITE.com to your actual website.
For example, here I would use lancelhoff.com as seen below:RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lancelhoff.com/.*$ [NC] RewriteRule \.(jpg|jpeg|png|gif|zip|rar)$ /nolink.webp [R,L
] - 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.webp 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.webp, helping to prevent bandwidth theft while informing the person linking to the image to store a copy on their own server, instead.