Hotlink protection: stop other sites from using your images on their pages (cPanel)
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.
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).
- 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).
3. Turn on hotlink protection
- On the cPanel home page, open Hotlink Protection in the Security section.
- 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.
- Review the settings under Configure Hotlink Protection:
- URLs to allow access: cPanel adds your account's domains automatically in
http://andhttps://, www and non-www forms. Add other sites you allow to use your images, one per line (for examplehttps://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,webpat the end; you can also add extensions such assvgormp4if 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.
- URLs to allow access: cPanel adds your account's domains automatically in
- 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.
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
- 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.
- Type the address of one of your images straight into the browser's address bar; if Allow direct requests is ticked, it should open.
- 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.
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.
7. Related guides
- 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
Thanks for your feedback!
