• Wednesday, February 25, 2026

Knowledge Base

How to Set Up Hotlink Protection in DirectAdmin

Preventing Image and Bandwidth Theft

Stop other websites from embedding your images and using your bandwidth.

What is Hotlinking?

Hotlinking is when another website displays your images by linking directly to files on your server. This uses your bandwidth without benefit.

Enabling Hotlink Protection

  1. Log into DirectAdmin
  2. Click Hotlink Protection
  3. Select the domain to protect
  4. Enter allowed URLs (your own domains)
  5. Select file extensions to protect (jpg, png, gif, etc.)
  6. Choose what to show when blocked (optional)
  7. Click Save

Allowed Referrers

Add domains that should be allowed to use your images:

  • Your main domain (example.com)
  • Webmail (mail.example.com)
  • Search engines (optional)

Using .htaccess

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yourdomain.com [NC]
RewriteRule .(jpg|jpeg|png|gif)$ - [F]

Alternative: Show Replacement Image

Instead of blocking, show a "don't steal bandwidth" image:

RewriteRule .(jpg|jpeg|png|gif)$ /hotlink-warning.jpg [R,L]