Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: To avoid Bandwidth Theft using Hotlink Protection ?  (Read 13265 times)

0 Members and 1 Guest are viewing this topic.


  • Guest
To avoid Bandwidth Theft using Hotlink Protection ?
« on: April 05, 2014, 11:53:01 pm »
What is Hotlinking ?

Hotlinking is nothing but linking directly to images, media and other files present on your website hence your web hosting server.

What is Bandwidth Theft ?

We all are aware, bandwidth is the rate of data transferred between one point to the other in a given time frame. When browsing a particular website, you are actually using the bandwidth assigned to that web-site, whose cost is borne by the site owner. When you choose a particular web hosting package, there is fixed amount of bandwidth that is allowed to use, which if used in excess can make you pay more. You may refer What Is Bandwidth | Part 1 to learn more in detail.

However, when someone creates a direct link to images present on your server (ie. on your website) by adding them to their website, the images are served from your server wherein your bandwidth is used in the process. This is called bandwidth theft.

How to Prevent Bandwidth Theft ?

The Apache Server Mod Rewrite Engine holds the capability of examining the name of the document requesting for a file of a particular type. Incase, the URL of a webpage requests for an image file present on your server is from a known and allowed source, only then it will display the image. Else, a broken image is shown as an output.

Such logics and rules are added to the directory/ies containing the image files.

Steps for Preventing Bandwidth Theft

    You need to make sure that the Apache Server is compiled with mod_rewrite. It isn’t included as a default feature at the time of installation. In case you realise that mod_rewrite isn’t installed, you should not try to install it. You must bare in mind that trying to do so might make your website loose its functionality. It is advised to contact our Support Department for assistance. If you are a system admin yourself, you must refer the Apache INSTALL file for instructions about enabling mod_rewrite.
    Segregate the images into directories that don’t contain the HTML files used by your website. An inclusion of an empty index.html file into every directory holding the images would avoid individuals from looking into your directory listings.
    It is a good practice to create or edit .htaccess file in any of the directories holding the image files used by your website.

    Make sure that you include the below lines in the .htaccess file :

Code: [Select]
   RewriteEngine on

    RewriteCond %{HTTP_REFERER} !^$

    RewriteCond %{HTTP_REFERER} !^*$ [NC]

    RewriteCond %{HTTP_REFERER} !^*$ [NC]

    RewriteRule .*.gif$ – [L]

    RewriteCond %{HTTP_REFERER} !^$

    RewriteCond %{HTTP_REFERER} !^*$ [NC]

    RewriteCond %{HTTP_REFERER} !^*$ [NC]

    RewriteRule .*.jpg$
    - [L]
NOTE: Make sure that you’ve added the above in the same format as stated. Also, replace with your actual domain name.