How to Enable Hotlink Protection in cPanel

Hotlinking is the practice used by webmasters to directly link a media file (e.g. a photo or a video) from your website and display it on their web without saving a local copy on their server.

Without hotlink protection, other websites could be consuming your hosting bandwidth and this can lead to slow loading websites or higher costs of your hosting plans.

In this guide, we are going to take you through the steps of enabling hotlink protection and disabling other sites from loading media files directly from your website. We can enable this feature right from your cPanel account.

Prerequisites

  • A domain name e.g. www.example.com
  • Web hosting account that supports Cpanel
  • Cpanel username and password.

Step 1:
Login to your cPanel account

The first step is to log in to your cPanel account. Just enter your domain name followed by ‘/cpanel’ on a web browser, enter your username and password and hit ‘Log In’ to proceed.

Step 2:
Locate hotlink protection from the dashboard

On the search box, type ‘hotlink protection’ and click the icon that appears below as shown:

Step 3:
Use the hotlink manager to customize the settings

At the top of the screen, you will see the text, ‘Hotlink protection is currently “disabled”Just click the ‘Enable’ button under the text to activate the feature.

From this point forward, other websites will not be able to directly to your site files. However, to avoid completely locking your other websites from linking to the files, you should enter all your domains including their ‘www’ aliases under the ‘URLs to allow access:’ textbox.

For instance, if your website is www.example.com, make sure you have entered the below entries.

At the bottom of the screen, you will see an option of specifying the file extensions that you want to protect.

The file extensions that you want to block should be separated with commas. Then, check the option ‘Allow direct requests (for example, when you enter the URL of an image in a browser)

This option is useful if you want to directly download or access files from your website without visiting a complete web page directly.

You may enter a value on the field labelled, ‘Redirect the request to the following URL:’ if you specify a value here, users trying to access your hotlink protected files will be directed to the URL. You may leave this text box intact

Then click on submit button as shown:

If everything is setup correctly, you should see a success message:

Step 4:
Test the setup

Once you make any change on your cPanel account, it is advisable to test the settings in the production environment. To see whether hotlinking protection was enabled, create a sample HTML file and save it on your computer with ‘.html’ extension (e.g. hotlink.html), then reference any image from your hotlink protected website on that file.

<html>
  <head>
    <title>
    A Simple HTML Document
    </title>
  </head>
  <body>
    <img src='http://www.example.com/test.gif'>
  </body>
</html>

Then upload your file on a different website using an FTP client or cPanel File Manager and open your file on a browser (e.g. Internet Explorer or Chrome). If hotlinking protection is working as expected, you should see a broken link image instead of the hotlinked image as shown:

Conclusion

In this article, we have talked about hotlinking and how it can negatively affect your websites in terms of bandwidth. We have also taken you through the steps of enabling the feature in cPanel to protect other websites from ‘stealing’ your bandwidth. With the feature enabled, you will have a better experience of your website.

Check out the top 3 cPanel hosting services:

HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
A2 Hosting
$2.99 /mo
Starting price
Visit A2 Hosting
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
Hostens
$0.90 /mo
Starting price
Visit Hostens
Rating based on expert review
  • User Friendly
    4.5
  • Support
    3.8
  • Features
    4.3
  • Reliability
    4.5
  • Pricing
    4.8

How to Install a SSL/TLS certificate on Your Shared Hosting Account

This guide will show you how to install an SSL/TLS certificate in cPanel for a s
3 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How to Set Up SSH on an Ubuntu 16.04 VPS or Dedicated Server

This tutorial shows you how to set up secure shell (SSH) on an Ubuntu 16.04 virt
2 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How To Set Up SSH for an Ubuntu 16.04 VPS From a Linux Client

How to set up ssh private key authentication on an Ubuntu 16.04 server with a Li
2 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Use and Manage SSH Keys with cPanel

This guide shows you on how you can use cPanel to create and manage secure shell
3 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.