Xavier Media
Xavier Media Blog All you need to know as a web site owner, blogger or webmaster
Subscribe to our feed:

 Subscribe in a reader

Subscribe by email:
Enter your email address to subscribe to this blog by email:


Search this blog:

Protect your pictures and prevent bandwidth theft

January 27th, 2008 by User ImageAndreas from Xavier Media (Who am I?)

If you got a camera to improve your posts (like I wrote in Five things all bloggers need) then you will sooner or later find a jerk or two that’s stealing your work and using it on their own blog/web site. As a blogger you need to protect the content you’ve worked so hard for and you need protect your bandwidth from bandwidth theft. Unfortunately it’s not always so easy, but to protect your pictures from “hotlinkers” (people using content hosted by you as their own without giving you credits) there’s an easy to use way to make their life a little bit harder.

If you’re site is hosted on a Un*x server you can use something called .htaccess to make hotlinking almost impossible. I used this method when Xavier Media had a free Midi file archive at www.xaviermedia.com/midi/ so I know that it’s working :)

Create a text file called .htaccess.txt using Notes or Wordpad:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?sampleaddress.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/prohibited.jpe [L]

The first line turns the Rewrite Engine so this example will work, the second line will allow your own domain name to link to your pictures and the third line will allow empty referrals. [NC] on the second line means No Case and is used when you need SaMPleAddreSS.com to be the same thing as sampleaddress.com :D

In the fourth line you set the file extensions you want to rewrite and the image to display instead of the hotlinked images. Please note that the prohibited image is called .jpe instead of .jpeg so it will show in the visitors browser (otherwise you create an infinite loop which will case no image at all to show up :( ).

If you know the domain names of some bad guys hotlinking to your valuable stuff on your server you can use this code in your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+.)?facebook.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+.)?blogspot.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+.)?myspace.com/ [NC]
RewriteRule .*.(jpe?g|gif|bmp|png)$ /images/prohibited.jpe [L]

You can block as many domain names you like. Just make sure you add [NC,OR] at the end of each line except for the last RewriteCond line which should only have [NC] at the end.
When you’ve saved your work simply upload the file to your server (the www directory or maybe the directory where you keep your pictures). If you called your .htaccess file .htaccess.txt you need to rename it to .htaccess when you have uploaded the file to your server.

If you got other files you need to protect this example works with any other file type. I mentioned in the beginning of this post that I used it on midi files :)

Rate this:
2.5
Subscribe to new posts from this blog
You may also be interested in...
Web Hosting Choice
Lower prices for virtual dedicated servers
Privacy Matters - Free Credit Report and Score
Privacy Matters - Free Credit Report and Score
VehicleWarrantyQuotes.com hosted CPA
VehicleWarrantyQuotes.com hosted CPA

3 Responses to “Protect your pictures and prevent bandwidth theft”

  1. no imageDeimos Tel`Arin (Who am I?) Says:

    Gah! All these sounds too techie to me! -_-

    Will digest them later. :p

    Good write up though, thanks for sharing this. :)

    In the past, I came across a bandwidth theft php script that some guy wrote up, but that one got certain limitations.

    For myself? Well, basically I watermark all my images so the thief will be advertising my domain name if he decides to leech it.

    Rate this:
    2.9
  2. no image1 Million in 365 Day (Who am I?) Says:

    I was thinking about watermarking images too, but these tips might come in handy. Is there anything like that for blogger blogs too?

    Rate this:
    2.9
  3. no imagejonathan (Who am I?) Says:

    nice =) ive been looking for this for ages - i couldnt remember what it was called, but i have it now!!!

    cheers man

    jonathan’s last blog post..The British Music industry

    Rate this:
    2.5

Leave a Reply



U DROP - I FOLLOW
Win 700 Entrecard credits

Recent Comments:

  • Anonymous Domain Dude: A word to Domains By Proxy…that first does cost about 20$ and not 2$, and not protect...
  • Computer Forum: Amazing article! Detailed and very interested. I am going to recommend this blog to my friends.
  • vickn3s: woww.w..twitterfox works cool….thanks buddy!!
  • pushpendra: i want to create domain page for my site but i don’t know how to get started. I have created my...
  • Import from China: Nice post, you got some good points there - thank you.
  • iphone games music: Nice blog, i have added it to my favourites, greetings

Recent Trackbacks:



© Copyright 1996-2008 Xavier Media. All rights reservered.
Contact us | Support/help | Privacy Policy | Company Info | SiteMap
The World According to Xavier | Xavier in the World | the Xavier Media blog