How To Prevent Bandwidth Hijacking And Image Or File Hot Linking

Posted on: August 15th, 2007 by afox

A common problem people often run into is file hot linking. This is caused when someone links directly to an image or file on your site, using it, without actually hosting it themselves, and in essence, robbing you of your bandwidth. This can be very irritating as bandwidth can be expensive. Here’s a couple ways to prevent this. In order to make this work, you will need access to your .htaccess file. If one does not exist, simply place one in the directory to prevent hot linking. (Apache web servers) 1. To allow everyone except those you choose to deny access to your files and or images. Obviously offendingDomain.tld would be the domain you wish to block from accessing.

Default_Referer allow_referer Order_Referer deny_referer,allow_referer
Deny_Referer from offendingDomain.tld

2. To prevent everyone except your website and anyone you choose to allow try this. And yourDomain.tld would be your domain and aDomainYouAllow.tld would obviously be a domain you don’t mind hot linking.

Default_Referer deny_referer Order_Referer deny_referer,allow_referer
Deny_Referer from all Allow_Referer from yourDomain.tld Allow_Referer from aDomainYouAllow.tld

All in all, its pretty simple. Also very effective. If you are having problems making this work, make sure your using an Apache web server (usually on a *nix machine) and that you have permission to modify your .htaccess. Some hosting companies do not allow this. Give them a call, they should help.

Comments are closed.