Skip to content
0850 554 5439 [email protected]

What do you need help with?

Search the guides and tutorials, or browse the categories.

Hotlink protection: stop other sites from using your images on their pages (cPanel)

Shared Hosting 32 views Step-by-step guide Last verified: Markdown
What you will learnWhat hotlinking is, how to turn on Hotlink Protection in cPanel, how to set the allowed sites and protected file extensions, and how to check that the protection works.
Time6 minutes

1. What is hotlinking and why does it matter?

Hotlinking is when another site shows an image from your server on its own page directly from your address, without copying it. For example, the page example.com/galeri/ shows your image with <img src="https://ornekfirma.com/urunler/kapak.jpg">.

The effects:

  • Each time the image is viewed, the file is sent from your server; your bandwidth and resources are spent on someone else's visitors.
  • Your product photos or original images appear on another site as if they were theirs, without your permission.

Hotlink protection checks which page the image was requested from (the Referer information the browser sends) and turns away requests from sites that are not on your allow list.

Hotlink protection checks which page requested the image: sites on your allow list show it, others are blocked.

2. Before you start

How do I know my images are hotlinked? Be suspicious if your bandwidth use has grown unexpectedly compared with your visitor numbers. Check the referring sites list in the Awstats report in the Statistics section and the Referring URL column on the Visitors screen; if an unknown site sends many requests for your image files, they are being hotlinked (see B50).

Metrics → Visitors: if the Referring URL for requests to your image files shows another site, your images are being used on that site.
  • List any other sites you want to use your images: your own blog, your other domains, your store on a marketplace, and so on.
  • If you use a CDN in front of your site, images may be served from the CDN address; in that case it is better to set hotlink protection in the CDN's own panel.
  • The protection adds lines to public_html/.htaccess. If you have edited this file by hand, make a copy first (see B44, Section 2).
  1. On the cPanel home page, open Hotlink Protection in the Security section.
Hotlink Protection is in the Security section of the cPanel home page.
  1. The top of the page shows the protection status. If it is off, press Enable. If it is on, a Disable button appears in the same place.
Security → Hotlink Protection: the top shows whether protection is on or off; switch it with Enable or Disable.
  1. Review the settings under Configure Hotlink Protection:
    • URLs to allow access: cPanel adds your account's domains automatically in http:// and https://, www and non-www forms. Add other sites you allow to use your images, one per line (for example https://blog.ornekfirma.com).
    • Block direct access for the following extensions (comma-separated): the default list is jpg,jpeg,gif,png,bmp. If your site has WebP images, add ,webp at the end; you can also add extensions such as svg or mp4 if needed.
    • Allow direct requests: tick it. If it isn't ticked, people who type an image address straight into the browser, and some apps and browsers that send no Referer, are also blocked.
    • Redirect the request to the following URL: optional. If you leave it empty, unauthorised requests are refused; if you enter an address, the request is redirected there.
  2. Press Submit.
Enter one allowed address per line, separate the protected extensions with commas, tick Allow direct requests and press Submit.

cPanel writes the rules to public_html/.htaccess as RewriteCond %{HTTP_REFERER} lines. Don't edit these lines by hand; always use the Hotlink Protection screen to change the list.

Hotlink Protection writes its rules to public_html/.htaccess. Don't edit these lines by hand; always change the setting on the Hotlink Protection screen.
Info

On our test account we tried three cases: a request from our own site loaded the image, a direct request without a Referer loaded it (with Allow direct requests ticked), and a request from another site was blocked. On WordPress sites a blocked request may return WordPress's 404 page instead of 403; the result is the same, the image doesn't appear on that site.

4. Check that it works

  1. Open your own site; all images should look normal. If an image is broken, the address it is served from (for example a subdomain) is missing from the allow list.
  2. Type the address of one of your images straight into the browser's address bar; if Allow direct requests is ticked, it should open.
  3. Open the other site that uses your image (if you know it) in a private window; the image should appear broken. The browser cache may show the old image for a while.

5. Symptom → cause → fix

Symptom Likely cause Fix
Some images are broken on my own site The domain or subdomain the images are served from isn't on the allow list Add the address to URLs to allow access and press Submit
Opening an image address directly is blocked Allow direct requests is not ticked Tick it and press Submit
No preview image when sharing on social media The social network's server requests the image from another address Tick Allow direct requests for preview images; if it continues, turn protection off and test
Another site still shows my image The extension isn't on the list (e.g. webp), or browser cache Add the extension; test in a private window
The site returns 500 after turning protection on An error that already existed in .htaccess Check the Errors screen (B41)
My images come from a CDN, protection does nothing Requests go to the CDN, not your server Set hotlink protection in the CDN panel

6. Frequently asked questions

Does hotlink protection stop my images being copied?

No. It stops an image from being shown on another site from your server. If someone downloads the image and uploads it to their own server, this doesn't prevent it; for that kind of use you would need to take copyright action.

Will I still appear in image search results?

Search engines crawling your images are usually not affected. Still, if image traffic matters to you, watch your search console reports for a few weeks after turning protection on.

Is Leech Protection the same as Hotlink Protection?

No. Leech Protection limits the sharing of the same username and password with many people on a password-protected folder (see B45). Hotlink Protection stops your images being shown on other sites.

Can I allow one particular site and block the rest?

Yes. Add the site's address in https:// form, and with www if needed, to the URLs to allow access list.

How do I turn protection off?

Press the Disable button at the top of the Hotlink Protection screen. cPanel removes the lines it added from .htaccess.

Did you know?

If you serve many large images or videos, you can move these files to Gyro Object Storage (S3) and serve them to your site from there. Your hosting account's space and resources stay free for your site.

  • B45 — Password-protecting a folder and blocking IP addresses
  • B44 — Redirects with .htaccess: www, HTTPS and 301
  • B43 — My hosting disk space is full
  • B50 — Visitor statistics and logs (Bandwidth)
  • B09 — My site returns 403 Forbidden
Was this helpful?

Thanks for your feedback!

Still Need Help?

The support team is here around the clock for anything you can't find in the knowledge base.