October 1, 2019
3min Read
Elvinas S.
If you have a media-rich website, the last thing you want to find is people stealing your content by hotlinking. To prevent such actions, you’ll have to enable hotlink protection. In this article, we’ll cover four ways on how you can do just that.
Hotlinking is the act of directly linking files from other websites. It’s also known as bandwidth theft since by doing so, you’ll be using up their resources.
There are a few websites that allow this practice, like YouTube. From its sharing option, you can find an embed link:
However, for most websites, hotlinking is not allowed. There are two reasons for that:
The above reasons show that enabling hotlink protection is a crucial step if you’re managing any type of website.
Configuring hotlink protection is not complicated. Here are the four methods in which you can set it up:
Hostinger users can activate hotlink protection through hPanel. It’s quick and straightforward. First off, sign in to your hPanel:
If you’re using a CDN or Content Delivery Network, you can also enable hotlink protection. Depending on your CDN service, it can be done through the settings page.
As an example, with KeyCDN, you can restrict the HTTP referrers for direct-linking. Their Zone Referrer feature allows you to block hotlinking by setting specific domains that can access your assets. To do that:
If you’re using Cloudflare, you can follow these steps:
You can also avoid hotlinking by modifying the .htaccess file. However, this method is preferable for advanced users only. Despite its effectiveness, tiny mistakes can bring your site down. So, be careful when applying this method:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mywebsite.com [NC] RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
You can delete certain file extensions from the provided code if using .htaccess to allow the formats to be hotlinked
This method can also be done using an FTP client, we recommend Filezilla.
This last method is beginner-friendly. You just need to install a plugin and activate it.
Here are the hotlink protection plugins that are worth considering:
Hotlinking is a bad practice of direct-linking other people’s website files without their permission. It can cause problems such as bandwidth and asset theft. To protect yourself from it, you’ll have to set up hotlink protection on your site.
There are four methods to activate it:
Feel free to pick whichever method that suits you and good luck!
Leave a reply