How to prevent bandwidth theft by sites that 'hot link' to your graphic files.
 by Casey Markee

How to prevent bandwidth theft by sites that 'hot link' to your graphic files.

  • We are experiencing a lot of bandwidth leeching due to external sites hot linking to our images without permission. Is there any way to prevent sites from accessing our images for display on their site with no benefit to us whatsoever?

Answer: Hotlinking—aka, inline linking, leeching, direct linking, and offsite image grabs—refers to the practice of using a linked object (usually an image, but it could also be a document) that resides on one website for display on an external, unrelated website.

A surprisingly large number of people are unaware that the practice of hot linking is not only irritating to the average site owner, it also constitutes an unfair (and arguably illegal) use of the hosting site's images and bandwidth when done without permission. Excessive hot linking can also be cause for slowing down a site's page load times. In short, you have reason to be concerned.

By linking directly to your images, and requiring your server to serve your content to their site audience, these offending sites are stealing bandwidth. It's no wonder that hotlinking is cursed within the online community. Offending sites attempt to display for free content they would otherwise have to pay to provide.

Fortunately, the addition of some specific code to your .htaccess file can completely prevent external sites from hotlinking certain types of files that are hosted on your site. Typically this strategy is used to prevent image files (i.e., .jpg, .gif, .png) CSS, and Javascript from being accessed by bandwidth thieves.

Here's the code:

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

Add it to your

TO READ THE FULL ARTICLE