PDA

View Full Version : .htaccess to prevent image linking


Cid
03-27-2001, 03:18 AM
My site is eyesonff.com

I need to know what to put in my htaccess file to prevent someone from img srcing my pics to an outside page. I have a lot of screenshots with no logos or watermarks that people like to take advantage of for bulletin board signatures and whatnot.

What EXACT htaccess file would I create to cause them to recieve broken links?

I already refered to the htaccess faq in the cp, and while it was useful from preventing downloading, it didn't change outside images linking.

Anyone?

Damian
03-27-2001, 02:49 PM
Cid,
Don't have an answer, but I would love to know it also.

I just discovered that pic of mine was being linked to.

I know that blocking an img src is possible, I've seen people try to link to an image from angelfire site. instead of getting an image, they get a "image hosted by angelfire"...

if nothing else I would like to do this so I could maybe draw that much more traffic from the link. When my image was linked to, I had about 300+ views of that image from an external site...

hope that makes sense....

can anyone help?

BTW Cid, you got an awesome site there...FF rules...now I know where you got your handle from :)

W

4serendipity
03-27-2001, 03:40 PM
The only way of combating this situation with an .htaccess file is by using Apache ModRewrite, which I don't think is installed on the servers (somebody please correct me if I'm wrong).

Fortunately, there are script solutions to this problem. If you search for “anti-leach” “bandwidth protection” on any of the big script sites you’ll find plenty of examples.

Here are just a couple:

http://www.thesitewizard.com/archive/protectimages.shtml
(uses PHP)

http://www.spaceports.com/~scifi/bandwidthbob.html
(PERL)

Odium
03-27-2001, 05:06 PM
This isn't really a solution for the problem, but it does tend to get peoples' attention...I noticed one day by checking my access logs that a guy was linking to a small 16x16 bullet-type graphic from my site, to use on his message board...well, I replaced the bullet graphic with a large 800x800 image depicting a pirate (you know, a seafaring pirate) within a "NO" symbol and then wrote a message underneath saying something like "stealing bandwidth sucks". Of course in the end that just cost me more bandwidth, but it was just one guy and my site doesn't use much bandwidth as it is. Within a few hours the guy took down the linked image and emailed me apologizing profusely, explaining that he didn't know linking to my image was stealing bandwidth. Not a solution, but pretty funny to do all the same.

Cid
03-28-2001, 04:15 AM
Originally posted by Odium
This isn't really a solution for the problem, but it does tend to get peoples' attention...I noticed one day by checking my access logs that a guy was linking to a small 16x16 bullet-type graphic from my site, to use on his message board...well, I replaced the bullet graphic with a large 800x800 image depicting a pirate (you know, a seafaring pirate) within a "NO" symbol and then wrote a message underneath saying something like "stealing bandwidth sucks".

I've honestly done that before :D Someone was using my new topic / add reply buttons and even claiming the art work was their own. I changed them to huge images.... it was messy >_<

Originally posted by 4serendipity
The only way of combating this situation with an .htaccess file is by using Apache ModRewrite, which I don't think is installed on the servers (somebody please correct me if I'm wrong).

Fortunately, there are script solutions to this problem. If you search for “anti-leach” “bandwidth protection” on any of the big script sites you’ll find plenty of examples.

Here are just a couple:

http://www.thesitewizard.com/archive/protectimages.shtml
(uses PHP)

http://www.spaceports.com/~scifi/bandwidthbob.html
(PERL)


I checked out both links, but they both require that I re-link all my images to something like bandwithsaver.cgi?screenshot1012.jpg. I have well over 1000 images on my site, and that would take ages, as well as ruin the image.cgi links I already have up. Don't get me wrong, thanks for the help, but does anyone know how to do it properly through htaccess?

Originally posted by wackyman4937
Cid,
BTW Cid, you got an awesome site there...FF rules...now I know where you got your handle from :)

W

Thanks a lot :D I mean it.

mart
03-28-2001, 01:01 PM
There is relief for graphic thiefs. Go to http://www.artistscope.com
There you can download and register a free version of Artistscope Secure Image.
I use it, and it's great! All you have to do is register your domain name, and they will send you a key to unlock it, and all for free. I just upgraded to version 2.1, which is $65.00, but version 2.2 is free.
Give it a try, I'm sure you'll like it.

4serendipity
03-29-2001, 09:03 PM
Secure Image looks cool. Now if only I had any images that were worth stealing :-).

As a side note, if you would like to see how you could block outside requests fro images using ModRewrite and a .htaccess file check out:

http://www.perlaccess.com/tutorials/8/8.6.html


Andrew
http://www.4serendipity.com

Cid
03-30-2001, 04:22 AM
Thank you, 4serendipity! That's exactly what I wanted!

Great work! It works fine. That should save me about 1 gig a month.

foe
03-30-2001, 06:04 PM
You could make php script, which you put in the src code, it will check the referer, if the rererer is from your domain, it will show the pic (not html page, but actually binary pic) and if not it can show an erorr pic

Damian
03-31-2001, 01:46 PM
that .htaccess code works wonders...i've had a few images hotlinked off my site...and while they're not original (like parody banners and such) it still get's really annoying.

side note -- I had a little graphic on my site that "powered by VC" that was getting hotlinked....

so I made a new HUGE image (yellow background, red text "go steal your images elsewhere") and named it the same name of the linked one...

needless to say, it really screwed up the other person's forums....guess it's something only a nerd would find funny :)

W

musicforme
04-22-2001, 01:46 PM
I checked out the link 4serendipity included. If I wanted to block links to more than one file type, would I need to add the entire script for each file type (ie .jpg. mpg) or just add an additional line to the RewriteRule?

I'm in the process of moving my web page to HostRocket and new to some of the available features.

Thanks

Damian
04-22-2001, 02:03 PM
You know -- that's a good question. I just duplicated the script for every file type I wanted protected from hotlinking.


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://disconnectsouth.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.disconnectsouth.com/.*$ [NC]
RewriteRule .*\.gif$ - [G]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://disconnectsouth.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.disconnectsouth.com/.*$ [NC]
RewriteRule .*\.jpg$ - [G]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://disconnectsouth.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.disconnectsouth.com/.*$ [NC]
RewriteRule .*\.wav$ - [G]

xtra
05-04-2001, 08:55 AM
What's the point of this?? When someone wants a picture, he saves the picture in his own domain or if is is protected, saves the page and gets the picture.
Correct me, if I'm wrong, but I really see no utility on this.

Odium
05-04-2001, 10:23 AM
This isn't about taking images, it's about linking directly to them and stealing bandwidth. That's the point.

Consider yourself corrected.

simpe
05-10-2001, 08:08 AM
I want to know what code I need to add to my htaccess to enable subdomains to access my photo directory. Right now I store all the photos I use for the public journaling website, but LiveJournal.com uses subdomains for paid accounts and permanent accounts.

It wasn't until I was checking my site in Netscape 4 that I saw the images weren't linking because my journal uses the subdomain URL to make it shorter.

Can someone help?