How to protect your bandwidth by htaccess

Many bloggers, webmasters copy paste the resource URLs linking directly to non-html objects not on one own’s server, such as images, .js files etc. The victim’s server in this case is robbed of bandwidth (and in turn money) as the violator enjoys showing content without having to pay for its deliverance. The most common practice of hot linking pertains to another site’s images.

The best way to stop hot linking is to have your images be placed in a seperate folder (not the same folder as html files) and put a .htaccess file in it.

Copy this text below, make the changes to show your domain info, and paste it into notepad. Name this file .htaccess and place in in all your images folders. Be sure to upload in ASCII mode or the .htaccess file will not work.

Be sure to replace “” with your own. The above code causes a broken image to be displayed when its hot linked. You can have an image display for those who try to hot link. You can have an image of your choice be displayed for those attempting to steal bandwidth. The code for this is:

The first line tells Apache to turn on the MOD Rewite.
The next two lines you change to your address (either with, and without the www. as well as your IP).
The last line is where you would like the link from the site trying to download from their pages to be redirected. This way if some one links directly to your “coolpicture.jpg” from their website, instead of seeing your cool picture the user will see a picture that you decide to show. Make the picture be something the user will not want to see and get the message across that he is a bandwidth stealer. After the user sees that the “hot linking” isn’t working, the user will change his links.

Related Posts

About the Author: