Knowledgebase

How to enable Hotlink Protection in cPanel (stop other sites using your images)

Hotlinking happens when another website shows your images (or videos and files) by linking directly to your server. Their page looks good, but your hosting pays for the bandwidth and resources. This guide shows you how to enable Hotlink Protection in cPanel so that only your own sites can embed your files.

How Hotlink Protection works

When a browser loads an image, it usually tells the server which page asked for it (the referrer). Hotlink Protection checks that referrer. If the request comes from a site that is not on your allowed list, the server refuses to send the file, or sends a different one. The tool writes these rules into your .htaccess file (see how to use the .htaccess file).

How to enable it

  1. Log in to cPanel (how to log in to cPanel).
  2. In the Security section, open Hotlink Protection.
  3. Click Enable.
  4. Check the box URLs to Allow Access. cPanel fills it with your domains, with and without www, over http and https. Add any other site that should be allowed to show your files, one per line, for example a second domain you own.
  5. In Block direct access for the following extensions, list the file types to protect, separated by commas, for example:
jpg,jpeg,gif,png,webp,bmp,mp4,pdf
  1. Leave Allow direct requests ticked. This lets people open a file by typing its address, and lets apps that send no referrer (many email programs and link-preview tools) still load your images.
  2. Optional: in Redirect the request to the following URL, enter an image or page to show instead, for example a small banner with your logo.
  3. Click Submit.
Test it: open your site in a private window and make sure every image still loads. Then share one of your pages on WhatsApp or Facebook and check that the preview image appears. If it does not, make sure Allow direct requests is ticked.

Things to watch out for

  • Do not protect .css, .js or font files unless you know why. Blocking them can break the design of your own site in some browsers.
  • CDNs and subdomains: if you serve images from a CDN or a subdomain such as shop.yourdomain.com, add it to the allowed list.
  • Cloudflare: if your site uses Cloudflare, you can use its own Hotlink Protection setting (under Scrape Shield) instead. Do not turn on both without testing.
  • Google Images: search engines usually crawl your images directly and are not affected, but test your important pages after enabling.

How to disable Hotlink Protection

  1. Open Hotlink Protection in cPanel.
  2. Click Disable. cPanel removes its rules from .htaccess.

Common problems

  • Your own images disappeared: a domain or subdomain you use is missing from the allowed list, or your site is opened over a different address (for example http vs https). Add the missing URL and submit again.
  • Images are missing in your newsletter: email services often load images from their own servers. Add their domain to the allowed list or host newsletter images with the email service.
  • The site shows a 500 error after enabling: the .htaccess file may contain a conflicting rule. See how to fix a 500 Internal Server Error and contact us.

Frequently asked questions

Does Hotlink Protection stop people from downloading my images?

No. Anyone who can see an image in a browser can save it. Hotlink Protection only stops other sites from embedding your files and using your bandwidth.

Will it slow down my website?

The effect is very small. It can even save resources if many other sites were loading your files.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • hotlink protection, image theft, bandwidth, cpanel, security, htaccess

Was this answer helpful?

0 Users Found This Useful