Home » Blog Tips

How to stop bandwidth stealing with htaccess file

Bandwidth Stealing is a scenario when somebody uses a file from your site directly to his. This results in consumption of your bandwidth. Many people does not realize but this is a common problem and as there is no direct way to know about it, we never get to know about it. This scenario can not only lead to your hosting banning your site as its out of bandwidth but your content is getting stolen too. If you want  you can read about Top Five Ways to stop content stealing

What is hot linking?

Hot linking is a scenario where some other site uses files hosted on your site. This results in bandwidth stealing as every time the hot linked page is viewed, images or files are requested from your server hence your bandwidth is use.

How to find if my files are hotlinked ?

There is no direct way, But when I asked my hosting about it, they said we can check our web stats and find out how much bandwidth is being used by which page or other things. If you something very high try to find out where it is linked.

How to stop hotlinking using .htaccess file ?

This can be helpful for PHP based site and wordpress based sites.

Before you write your own rules, enable the hot linking protection enabled and then write into .htaccess file. I did it reverse and my site gave Error 500. Be Careful. In case if something goes wrong just remove the .htaccess file and replace with original one ( Did I forgot to say backup your .htaccess file first ? Please do it ) and be sure mod_rewrite is enabled. Ask your hosting about it.

There are three ways of doing it.

  1. Ban all hotlinkers
  2. Ban one particular hotlinker
  3. Show a different image to one particular hotlinker

I followed the second step as I came to know who was stealing my content. Here is the code I used


# BEGIN WordPress

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://xxx.com/.* [NC]
RewriteRule \.(gif|jpg|js|css|JPG)$ - [F]

# END WordPress

You can replace xxx with the site who is stealing your bandwidth and in second line you can restirct files by extension or types. Remember This is to just avoid one hot linker. Here is the link to complete guide of all the three scenarios. Stop Image Hotlinking using .htaccess and this article How Do I Stop Hotlinking and Bandwidth Theft? can explain you meaning of each line and terms being used. I would recommend using the first link for implementing the code and second to understand it better. ( I got some problem while using the code from second article)

I don’t have PHP based Site or Wordpress What should I do?

Not sticking to just wordpress but every hosting has Hot Link Protection feature. You can query your hosting about it and ask how to enable it. Just remember, you should allow your site url to access it.

Since I faced this problem, I wanted to share it with you all. I hope this helps many others.

Tagged with:

Translate to EnglishÜbersetzen Sie zum Deutsch/GermanΜεταφράστε στα ελληνικά/GreekПереведите к русскому/RussianOversetter til Norsk/NorwegianÖversätta till Svensk/Swedishहिन्दी अनुवाद करने के लिए/Hindi
Tradueix al català/CatalanTulkot uz latviešu/LatvianPreložiť do slovenčiny/SlovakVertaal aan het Nederlands/Dutchترجمة الى العربية/ArabicTraduzca al Español/SpanishTraduisez au Français/French
Traduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese한국어에게 번역하십시오/Korean中文翻译/Chinese Simplified中文翻译/Chinese TraditionalПереклад на українську/Ukrainian

SMS subscribe Print This Post

Posted on 9th May 2007 by Ashish Mohta , A tech blogger who writes about solving day to day problems of people who use computer. He also writes on How to use the applications like Office, PC tips, Online tools,Browsers and more. All posts by Ashish Mohta | Connect with me @ Twitter | Linkedin | Facebook | Stumble | Need more help? Ask your Questions at our Support Center

Leave your response!

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>