How to Enable Hotlink Protection (Prevent Others from Stealing Your Media)

Hotlinking is when other websites directly link to your media (like images or videos), using your bandwidth. You can protect your resources using built-in tools in cPanel or manually in DirectAdmin.

Evans

Last Update hace 2 meses

a) For cPanel Users

Step-by-Step:
  1. Log in to cPanel

  2. Locate Hotlink Protection

    • Scroll to the Security section.

    • Click on “Hotlink Protection.”

  3. Enable Hotlink Protection

    • Click the Enable button if it’s not already enabled.

  4. Specify Allowed Domains

    • Your domain should already be listed.

    • Add any other domains you trust (e.g., subdomains or CDN).

  5. Specify File Types

    • Common types to protect: jpg, jpeg, png, gif, bmp, webp, mp4, etc.

  6. (Optional) Redirect Hotlinked Requests

    • You can enter a URL (e.g., an image that says "no hotlinking allowed").

  7. Click “Submit” to Save Changes


Done! Your media files are now protected against hotlinking.

b) For DirectAdmin Users

DirectAdmin currently doesn’t have a native GUI tool for hotlink protection, but you can do it via .htaccess.


Step-by-Step:


  1. Log in to DirectAdmin

  2. Open File Manager

    • Navigate to:
      System Info & Files → File Manager → public_html

  3. Edit or Create .htaccess

    • Right-click on .htaccess and choose Edit, or click Create new file if it doesn't exist.

  4. Paste the Following Code:

 Replace yourdomain.com with your actual domain.


What this does:


  • Allows media loading only from your own domain.

  • Blocks direct access from other websites.

  • Prevents bandwidth theft from hotlinked files.

(Optional) To Redirect to a Custom Image:

Verify Hotlink Protection

After setting up:


  • Try embedding an image from your site on an external site or tester.

  • If protection is working, the image won't load (or will be replaced with your redirect image).

Was this article helpful?

1 out of 2 liked this article

Still need help? Message Us