Stop image bandwidth theft

Prevent other websites from stealing your bandwidth by including your images in their pages.

  • Apache
    This example services up a different image instead:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} ^http://.*$
    RewriteRule \.(jpe?g|gif|bmp|png)$ /media/nohotlinks.png [L]
  • Lighttpd
    $HTTP["referer"] !~ "^(http://example\.com|http://www\.example\.com)" {
      $HTTP["referer"] != "" {
        url.access-deny = ( ".jpg", ".jpeg", ".png", ".gif", ".pdf" )
      }
    }

    Includes a remote IP option if you have certain IP's you want to be able to get at the images:

    $HTTP["referer"] !~ "^(http://example\.com|http://www\.example\.com)" {
      $HTTP["remoteip"] !~ "^(127\.0\.0\.1)$" {
        url.access-deny = ( ".jpg", ".jpeg", ".png", ".gif", ".pdf" )
      }
    }
  • Varnish
    Varnish rules to server a result quicker?

    Resources
    Bandwidth Theft | Preventing image hotlinking with .htaccess
    Smarter Image Hotlinking Prevention
    Using Varnish to capitalize on image hotlinkers and retain referred visitors

Recent Updates

  • 4 days 23 hours ago
    1.27.2 update
  • 2 weeks 2 days ago
    Drupal 10/11 config
  • 2 weeks 3 days ago
  • PHP
    2 weeks 3 days ago
    PHP 8.3.11 and AlmaLinux
  • 2 weeks 4 days ago
    New version of Pound