[TIPS] Prevent Image and File Hotlinking From Your Blog

Last couple days i found that some website doing image and file hot-linking to my website. This will steal my bandwidth and make me less visitor to come to my blog. If this happen to you too, don’t worry. We can prevent those bandwidth theft by prevent hot-linking by add some lines to our .htaccess file.

How do i know that my blog hotlinking? You can test by make a single html file with an image link to your blog, here is the example:

<img src="http://your-blog-name.com/image.jpg" alt=""/>

if you can see the images, then your site can be hotlink.

So, how i can prevent image and file hotlinking? Let’s follow these steps:

  1. Download your .htaccess from your site with ftp client
  2. Open your .htaccess file
  3. Add these lines:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yoursite.com/(.*)?$ [NC]
    RewriteRule .(jpg|jpeg|png|gif)$ - [NC,F,L]
  4. Save .htaccess file, and overwrite the one in your site.
  5. Test it!

If you have any question, don’t hesitate to leaev any comment or pm me 🙂

Have a nice day!!


  1. KeHoeff says:

    hey this is a very interesting article!

  2. KeHoeff says:

    hey this is a very interesting article!

  3. Dei says:

    Nice artcle, i use the tutorial to our client site 🙂

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.