Protect Your Bandwidth: Disable Hotlinking

Aside from spammers, there’s another group of Internet users that we need to protect our blogs from: bandwidth stealers. I guess it’s okay if you’re on Blogger and Google hosts all your images for free, then hotlinking is fine. Of course ownership of hotlinked files is a whole matter altogether, but that’s not the main point of this tutorial.

When you are self-hosting and paying for your bandwidth allocation, hotlinking becomes a serious matter. Some hotlinkers, I believe, do not even realize that they are stealing bandwidth from other webmasters by directly linking to the images, JavaScript files, etc. Some most definitely know what they’re doing, which makes it all the more irritating as they are not only stealing your files, they’re stealing your bandwidth as well.

So. What to do?

We’ll use the wonders of .htaccess. No need for plugins, as this is only several lines of code. Of course, before doing anything to your site files, you should always, always have a back up in case something goes wrong. Remember that .htaccess is a hidden files, so you have to show your hidden files first before you can actually backup and edit your .htaccess. Anyway, here is the code:

[javascript]RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your “don’t hotlink” image url
RewriteRule .*\.(jpe?g|gif|bmp|png|js|css)$ http://www.mysite.com/myimage.jpg [R,L]
[/javascript]

Remember to replace mysite with your own blog URL. The code also allows replacement of the stolen image with your own image. Just replace http://www.mysite.com/myimage.jpg with your own image. Make it imaginative. A funny text or a scary graphic, whatever floats your boat.

SHARE THIS article
Facebook
Pinterest
Twitter
Print
Email

GET UPDATES

Sign up to my newsletter so you get first peek into my detailed reviews, latest updates and occasional fun emails.

3 Responses

  1. okay, thanks for this info kaye, will try to do it myself. 😀 follow ko lang lahat ng instructions… dami naman mga bad elements sa net ohhh.

Leave a Reply

Your email address will not be published. Required fields are marked *

STAY IN THE KNOW

Sign up to my newsletter so you get first peek into my new uploads, detailed reviews, latest updates and occasional fun emails.