One of the first things I was taught not to do when learning about black hat SEO was hotlinking. It was one of those things crooked marketers did to reduce their bandwidth usage costs or deliberately attempt to slow competitor websites.
Since you own a public website (whether a personal one or for your business), it’s crucial to be on high alert against these techniques.
In this article, I’ll explain what hotlinking is and how to prevent it from happening to your website.
Table of Contents
- What is hotlinking?
- What is image hotlinking protection?
- How do you prevent hotlinking?
- Why is hotlinking bad? (+ Hotlinking Example)
What is hotlinking?
Hotlinking is the act of linking to a file that is hosted on another site, instead of downloading the file, hosting it on your own server, and providing proper citation. Images are most frequently hotlinked, but audio files, movies, flash animations, and other digital assets can also be hotlinked.
In other words, image hotlinking is the act of using someone else's images on your website by directly linking to those images from your website.
Hotlinking is like someone secretly connecting a pipe to your home‘s gas line to heat their house. When they turn on their heat, they’re using your gas, increasing your bill, while appearing to provide their own heating to anyone who visits.
That's exactly what hotlinking is — someone else using your resources (bandwidth) to power their website while you foot the bill. So much cunning.
HubSpot's Free Website Builder
Create and customize your own business website with an easy drag-and-drop website builder.
- Build a website without any coding skills.
- Pre-built themes and templates.
- Built-in marketing tools and features.
- And more!
Why is hotlinking bad? (+ Hotlinking Example)
As a marketing expert, I’ve seen my fair share of tactics that ultimately do more harm than good. One of them is hotlinking.
Here are some reasons I consider hotlinking to be a bad idea.
You have limited control.
When you choose to hotlink a media file, you have no control over what the file’s owner might choose to do with it.
If the owner wants, they can delete the file and you’re left with broken media on your website.
Some others have gone as far as substituting the hotlinked media with inappropriate content to serve as a warning.
It might cause legal complications.
As a creator and website owner, I know firsthand the time, effort, and resources that go into producing quality digital media.
I wouldn’t want anyone to take what I create and use it without permission.
In the event that someone hotlinks your website content, you could take legal action against such a person. However, legal fees can run high and become an expense you cannot afford.
It is poor etiquette.
Since hotlinking requires the website hosting the file to use its own bandwidth to load it on your site, it’s considered poor etiquette.
I’ll even call it theft.
That’s because it eats up the bandwidth of the site you took it from without giving them the benefit of increased traffic.
In other words, you’re essentially making that website pay for part of your hosting bill.
That’s how American cartoonist Matthew Inman felt when the Huffington Post UK hotlinked one of his comics. Since he owned and hosted the multiple images that made up the comic, he replaced them with a note and a screenshot of his monthly hosting bill. Here’s a screenshot of how the article appeared on the HuffPost after he made the swap:
To avoid running into a similar situation as Inman, you can take steps to prevent websites from hotlinking files hosted on your website. Let's dig a little deeper into this below.
What is image hotlinking protection?
Hotlinking protection is protecting a website's content — most commonly images — so that only authorized users can access it.
This is important because hotlinking can be detrimental to websites, leading to excessive usage of server resources, slow page loading times, and increased hosting costs without any benefits to the site owner.
Investing in hotlinking prevention can save valuable bandwidth and increase your website's speed and performance.
Additionally, hotlinking prevention can safeguard your website from being associated with other less reputable sites that may be hotlinking to your content.
This tactic can also help search engines recognize that your site is of higher quality and more professional than those that allow hotlinking.
How do you prevent hotlinking?
- Use a CDN with hotlink protection.
- Add code to your .htaccess file.
- Disable right-click functionality.
- Add a watermark to your images and other assets.
- Rename hotlinked files.
- Issue a takedown request.
- Block IP addresses.
Below are various preventive and reactive measures you can take to stop others from hotlinking your files. Doing so can help protect your bandwidth and optimize your website performance.
1. Use a CDN with hotlink protection.
The easiest and safest way to prevent hotlinking is to use a CDN that offers built-in hotlinking protection.
For example, Cloudflare offers hotlink protection to prevent other websites from linking to your image resources or abusing your bandwidth.
Once enabled, this feature will block websites from linking directly to your image resources. These users can still view and download images from your website, however, which means they could properly download, host, and cite images from your website.
Please note that hotlink protection may interfere with crawling bots such as Googlebot, preventing them from accessing and indexing your content — which could affect your SEO and traffic.
2. Add code to your .htaccess file.
Another way to prevent hotlinking on your site is to add the following snippet of code to your hypertext access file.
You can access this file using an FTP client or File Manager.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)example.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|php|png|css|pdf)$ - [F]
Please note you’ll have to replace “example.com” in the third line with your domain name.
3. Disable the right-click functionality.
To hotlink an image, users typically right-click the image, copy the image address, and embed the URL onto their site.
To prevent hotlinking, it would make sense to disable the right-click functionality then. Or would it?
Disabling right-click functionality on your images is a controversial solution — mainly because it won’t prevent all users from hotlinking. Some users will easily be able to work around this obstacle if they are insistant on hotlinking your images.
However, disabling the right-click functionality may stop users who would have unintentionally hotlinked or done so without malicious intent. In that case, reducing the total number of image copies on your site might be worth trying.
Here’s the pure JavaScript you’ll need to add to your site.
<script type=“text/javascript”>
var message=“Function Disabled!”;
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false; }
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function(“alert(message);return false”)
</script>
4. Add a watermark to your images and other assets.
Adding a watermark to your images and other media objects is a more user-friendly solution than preventing all users from right-clicking on your images. This solution won’t stop every user from hotlinking your resources, but it will make some think twice.
While your website will likely contain a copyright notice in your website footer, you can emphasize your ownership of your content by adding a text watermark to all your images (or the most popular ones).
This watermark can include your name, logo, or the copyright trademark and year. It can also consist of more information, including the penalty that will be enforced if a user hotlinks or otherwise misuses your private property.
You can use a free tool like Watermarkly to add watermarks. A premium tool like Adobe Lightroom Classic works great if you have want to add watermarks in bulk.
5. Rename hotlinked files.
Even if you complete some of the steps above, multiple sources will likely still hotlink images on your website. If you notice that one image is being hotlinked by a high-traffic website or many websites, which is causing a spike in your bandwidth usage, you can rename the file. Changing the image URL on your website will cause the hotlinks to break, prompting 404 errors.
This solution isn’t easy to scale, but it is effective for quick fixes.
6. Issue a takedown request.
A more direct approach to responding to websites that have hotlinked resources on your site is to issue a takedown request. A takedown request — also known as a Digital Millennium Copyright Act (DMCA) notice — tells a company, web host, or search engine that they are either hosting or linking to material that infringes on a copyright.
Here’s an example:
If the party receiving the notice is a hotlinker, they are expected to take down the material in question as soon as possible or download, host, and cite it properly. Otherwise, their internet service provider can forcibly remove the content or fine, block, or suspend the website.
Faced with such severe consequences, the website will usually remove the hotlinked content as quickly as possible.
7. Block IP addresses.
If you notice a spike in traffic on your site, then dig into your site analytics. Suppose you discover that a large portion of your traffic is coming from only a few sites, then they could be hotlinking images or other files on your site. In that case, you can rename the files, issue a takedown request, or block their IP address.
Blocking their IP address could be the final strike if a site repeatedly hotlinks an image or ignores a takedown request. Or you could block a domain right away if you don’t have or want to spend the time renaming files or threatening legal action.
Preventing Image Hotlinking on Your Website
While you’ll likely not hotlink other people’s content, you can’t say the same for other internet users.
The tips I’ve provided here will not only prevent hotlinking on your website, but protect the integrity of your brand and ensure you get due credit for your images and other media objects.
It can also save your bandwidth from accidental or intentional abuse and ensure you get the traffic you deserve.
Editor's note: This post was originally published in January 2021 and has been updated for comprehensiveness.
HubSpot's Free Website Builder
Create and customize your own business website with an easy drag-and-drop website builder.
- Build a website without any coding skills.
- Pre-built themes and templates.
- Built-in marketing tools and features.
- And more!