[TIPS] Prevent Image and File Hotlinking From Your Blog

Tuesday May 5, 2009 by  

Apache Logo

Apache Logo

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 hotnliking? You can test by make a single html file with an image link to your blog, here is the example:

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!!

What people search:

Other Interesting Articles:

Post comment as twitter logo facebook logo
Sort: Newest | Oldest

hey this is a very interesting article!

hey this is a very interesting article!