How To Enable Hotlink Protection

⏲️ Estimated reading time: 2 min

Enable Hotlink Protection prevents other websites from directly linking to your images, videos, and other media, which can save bandwidth and protect your content. Here’s how you can enable it depending on your setup:


1. Enable Hotlink Protection via cPanel

If your hosting provider uses cPanel:

  1. Log in to cPanel.
  2. Navigate to Security > Hotlink Protection.
  3. Click Enable.
  4. Add your own domain(s) to the Allowed Referrers list.
  5. Specify which file types you want to protect (e.g., .jpg, .png, .gif).
  6. Optionally, redirect unauthorized requests to another URL.
  7. Click Submit to save changes.

2. Enable Hotlink via .htaccess (Apache Servers)

If your site runs on an Apache server, you can manually add protection using the .htaccess file:

  1. Connect to your site via FTP or File Manager in cPanel.
  2. Open or create a .htaccess file in your website’s root directory.
  3. Add the following code: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^https://(www\.)?yourdomain\.com/.*$ [NC] RewriteRule \.(jpg|jpeg|png|gif|webp|mp4|mp3)$ - [F,NC,L]
    • Replace yourdomain.com with your actual domain.
    • Modify the file types as needed.
    • This blocks direct image hotlinking while allowing requests from your own domain.

3. Enable Hotlink via Cloudflare

If you use Cloudflare, follow these steps:

  1. Log in to your Cloudflare dashboard.
  2. Select your website.
  3. Go to Scrape Shield.
  4. Toggle on Hotlink Protection.

This will block external sites from embedding your images.



4. Enable Hotlink via Nginx

If your server runs Nginx, you can configure hotlink protection by editing your Nginx configuration file:

  1. Open the Nginx configuration file (e.g., /etc/nginx/nginx.conf or your site’s config in /etc/nginx/sites-available/).
  2. Add the following lines inside the server {} block: location ~* \.(gif|png|jpe?g|webp|mp4|mp3)$ { valid_referers none blocked yourdomain.com *.yourdomain.com; if ($invalid_referer) { return 403; } }
  3. Restart Nginx to apply changes: sudo systemctl restart nginx

5. Enable Hotlink Protection via WordPress Plugin

If you prefer a plugin-based solution, you can install:

  • All In One WP Security & Firewall (has hotlink protection settings)
  • Prevent Direct Access – Protect WordPress Files
  • WP Content Copy Protection & No Right Click

These plugins allow you to configure hotlinking protection without modifying server files.


Let me know which method you prefer or if you need help applying it to your specific setup! πŸš€

Report an issue (max 5 words):

Only logged-in users can submit reports.


Discover more from HelpZone

Subscribe to get the latest posts sent to your email.

Want to support us? Let friends in on the secret and share your favorite post!

Photo of author

Flo

How To Enable Hotlink Protection

Published

Welcome to HelpZone.blog, your go-to hub for expert insights, practical tips, and in-depth guides across technology, lifestyle, business, entertainment, and more! Our team of passionate writers and industry experts is dedicated to bringing you the latest trends, how-to tutorials, and valuable advice to enhance your daily life. Whether you're exploring WordPress tricks, gaming insights, travel hacks, or investment strategies, HelpZone is here to empower you with knowledge. Stay informed, stay inspired because learning never stops! πŸš€

πŸ‘ Like us on Facebook!

Closing in 10 seconds

Leave a Reply