Cloudflare Hotlink Protection restricts other websites from embedding supported images served through Cloudflare. Enable it in your domain's Security Settings, but check how it affects image sharing before leaving it on.
This is not a content-ownership system or a download lock. Cloudflare checks the request's HTTP Referer header, and the built-in feature covers specific image extensions, not every video or media file. We also cover an Apache alternative for sites that need origin-side rules.
What hotlink protection actually checks
Hotlinking happens when another page uses your image URL directly, so the browser requests the file from your site rather than from the other publisher's hosting. Cloudflare's feature denies image requests whose non-empty Referer does not include your website domain.
The supported extensions are gif, ico, jpg, jpeg and png. Do not treat that list as coverage for WebP, SVG, AVIF, videos or arbitrary downloads. A broad statement that enabling the toggle protects all assets would be misleading.
Requests with a blank Referer are not blocked by this check. The header can also be omitted or spoofed, so this is a deterrent to ordinary external embedding, not authentication. Someone who can view a public image can still download or copy it.
Need the domain first?
Runs the same live check as the front page. If it is taken we will show you when it expires.
Enable Cloudflare Hotlink Protection
- Sign in to Cloudflare and select the domain whose images you want to protect.
- Go to Security > Settings. This is the current location in Cloudflare's documentation; older screenshots may show Scrape Shield.
- Optionally filter settings by Client-side abuse.
- Find Hotlink Protection and switch the toggle to On.
- Check that the hostname serving your images is proxied through Cloudflare, then test both your own pages and intended sharing destinations.
A DNS-only hostname does not send its HTTP requests through Cloudflare's image checks. Review how to enable the Cloudflare proxy if your images are on a separate subdomain. Do not proxy unrelated email or verification records just to activate this setting.
To undo the change, return to the same setting and switch it off. Make that your first rollback if legitimate image embedding stops working immediately after activation.

Check sharing before blocking external embeds
Cloudflare says hotlink protection does not affect crawling, but it can prevent images from being displayed on services such as Google Images, Pinterest and Facebook. That distinction matters: a crawler accessing an image and a person seeing an image embedded on another site are not the same interaction.
Check your own articles, image links, social sharing and any feeds or partner pages that intentionally display your images. If an external service is supposed to use a logo, do not assume every external request is unwanted. A blanket block can conflict with the way you distribute content.
For files intended for reuse, Cloudflare supports a directory named hotlink-ok. For example, an illustrative URL such as https://example.com/images/hotlink-ok/logo.png is excluded from the check. A configuration rule can also selectively disable the feature for an image-folder path.
Plan exceptions before changing existing public URLs. Moving a file creates a different URL, so existing references must be considered. A configuration rule can be more appropriate when files need to stay at their current addresses. Cloudflare also recommends configuration rules when protection should apply only to specific hostnames rather than the whole zone.
Origin alternative: disable hotlinking with .htaccess
If you do not use Cloudflare, or need an origin-side image rule, Apache can check the Referer header too. This incorporates the server-side approach from our earlier hotlinking guide. It requires Apache with the relevant modules and permission to apply the directives; it is not an Nginx configuration.
Apache recommends simpler authorization directives where they fit. Its documentation shows SetEnvIf with Require as an alternative to mod_rewrite. The rewrite example below is useful when you already manage comparable rules in an allowed .htaccess file, but it needs testing in your hosting environment.
- Back up the existing .htaccess file before editing. Use your hosting file manager or another file-access method you already trust.
- Identify the document root or image directory where the rule belongs. Preserve existing application rules instead of replacing the whole file.
- Adapt the example below to your real allowed domains. Keep it outside application-generated sections that may be overwritten.
- Save, request a sample image with different Referer values, and check your site's normal pages.
- If access breaks or the server returns an error, remove the added block or restore the backup immediately.
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com(:[0-9]+)?(/|$) [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?partner\.example(:[0-9]+)?(/|$) [NC]
RewriteRule \.(gif|ico|jpe?g|png)$ - [F,NC]These are illustrative domains, not a ready-to-deploy allowlist. The first condition allows an absent Referer. The next two allow the named hosts; the remaining matched image requests receive a forbidden response. The hostname boundaries avoid treating a name such as example.com.other.example as your own domain.
Only list trusted hosts you actually need. Add subdomains explicitly rather than assuming the optional www covers all of them. Changing the extension pattern changes which files the rule covers; it does not turn a header check into reliable access control.
Test and troubleshoot the result
Request one sample image normally, from one of your own pages and with an external Referer. With command-line tools, you can explicitly set the header for comparison:
curl -I https://example.com/images/photo.jpg
curl -I -e https://example.com/article/ https://example.com/images/photo.jpg
curl -I -e https://unrelated.example/ https://example.com/images/photo.jpgCompare the responses with the policy you intended. If a CDN already has the file cached, origin-side rule changes may not be visible on every request until the relevant cached copy is refreshed. Use a targeted Cloudflare cache purge when appropriate, rather than repeatedly changing unrelated security settings.
For broader unwanted traffic, read our bot-blocking guide. Our domain lookup tool can assist with researching a referring domain, but lookup information is not proof of who embedded an image or a substitute for request logs.
Frequently asked questions
Does it stop copying or screenshots?
No. Publicly viewable images remain copyable. Use an appropriate authenticated delivery system when files must be private.
Can we protect videos with the Cloudflare toggle?
Not through this built-in feature's documented image-extension coverage. Choose a delivery and authorization method appropriate to the media instead of assuming the same toggle applies.