Forum Moderators: phranque

Message Too Old, No Replies

Hotlinking - How Do I Stop It?

         

dmje

1:06 pm on Dec 2, 2007 (gmt 0)

10+ Year Member



A great many of the bloggers out there seem to want to hotlink to a specific jpg, an ocelot of all things, that I have on my site.

I know how to prevent hotlinking to all my files, but can it be done for just a specific file? I want to try just one file at first if possible because I am not sure what would happen if I blocked access to all files, I do not understand the concept enough to make an informed decision about it.

Thoughts, Comments,

ambellina

10:22 pm on Dec 2, 2007 (gmt 0)

10+ Year Member



I've watermarked all of my images with our site address. I haven't tried to hunt down any possible hotlinkers, but I'm assuming that none of my competitors want to give me free advertising...

rocknbil

11:14 pm on Dec 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Search around the apache forum for "prevent hotlinking," this is easily done using .htaccess.

thecoalman

2:16 pm on Dec 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Slightly off topic but I used to have a little bit of fun with this, you can also serve a replacement image. I created a 1 X 32000px wide transparent .gif which will break a lot of layouts unless they specified the image dimensions. i.e the page will break right 32000 pixels.

They don't immediately realize it because they have the real image cached locally, by the time they do realize there page is messed up the image doesn't come to mind and they can spend forever trying to figure out what's happening because there is no visual reference since it's transparent.

Yea, I know I'm evil. :)

HRoth

3:21 am on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I had a lot of problems with hotlinking to certain images. At first I would rename the image blue_widget_no_hotlinking.jpg. This actually helps a lot. But with the worst ones, I just removed them from the site because it wasted too much of time (and yet I did not want to bar image searches, since I have seen people come for an image and stay to buy).

The other thing is to think about how they are finding your ocelot pic. Is it described as an ocelot in the image tag? Maybe you could rename it or take the name off. Then it might not be found so easily in image searches, esp. if your page has nothing to do with ocelots.

Jane_Doe

3:57 am on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Really, the possibilities are endless. I have not tried the large size image idea but that sounds like a good one to try.

Other ways to consider:

1. Rename the image and put an ad for your site at the old image for some free advertising. This is what I usually do.

2. Replace the original image with an adult picture. If the picture is being used at some place like Ebay, blogger or wordpress, then report the image stealer for having adult content on their site.

3. Replace the image with something weird like a foot odor ad.

[edited by: Jane_Doe at 3:59 am (utc) on Dec. 4, 2007]

jomaxx

6:14 am on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think it's a big enough deal to lose sleep over in most cases, and I'm certainly not bored enough to try to "have fun" with it, but I do ban a few big offending sites. The number one offender being MySpace, of course. If somebody from MySpace hotlinks your image, it can lead to umpteen thousand requests a day.

thecoalman

10:58 pm on Dec 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



[quote]At first I would rename the image blue_widget_no_hotlinking.jpg. [/qoute]

You can do that with htaccess, you don't have to rename the file. It will only serve the replacement when the referer is a web site other than your own.

HRoth

1:31 am on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But then it won't show up in Google image search, no? I get visitors from image searches who buy things.

jdMorgan

2:18 am on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's easy enough to make exceptions for selected domains such as Google.

HRoth

12:58 pm on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Easy for you, maybe.:) I messed with an htaccess file for hours and couldn't get it to work the way I wanted. Finally I decided that I was spending too much time on the issue.

jomaxx

5:42 pm on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, the .htaccess file requires syntax from Hell, and you can screw up your whole site (temporarily) if you make a mistake. The best thing is to find an example online that does almost what you want to do, then tweak it.

dmje

9:02 pm on Dec 5, 2007 (gmt 0)

10+ Year Member



I have tried to find examples of just that, but could not find an example that would work for just one file...

sem4u

9:58 pm on Dec 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is the code I use but it applies to all gif/jpg files:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(gif¦jpg)$ - [F]

cmendla

1:02 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For my new sites, I"m putting all my images in an images folder at the root with subfolders under that if necessary. That way, I usually only have to put the anti hotlinking htaccess in the images folder.

Also, you want to look for online hotlinking checkers. Local caching really makes it tough to try to determine if you are being leeched.

You can have some fun with it. I had a 60k pic that some guy was using as the logo for his Anti-Bush blog. I made up a pic with "W is the best Prez ever and anyone who thinks otherwise is a moron".. Since he was looking at a locally cached copy when he viewed his blog, it took him about 3 weeks to finally figure it out.. That was 21 'laugh a days' for me as I checked it each day..

Be careful with the anti leech stuff in cpanel. I've had cases where it has scrambled the .htaccess for things like subdomain redirects. Make sure you have copied of all of your htaccess files before you do anything.. (Ie at the root and in folders such as the root of any bulletin board or ecommerce apps)

cg.

Rosalind

1:42 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've watermarked all of my images with our site address.

I'm moving towards this for all of my larger images, but it takes time. I've also had hotlinking protection on for a long time, but it doesn't stop anyone who just wants to copy your pictures onto their server without giving you any credit.

I think you have to do both the .htaccess and the watermarking if you have a decent amount of images.

thecoalman

3:47 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can stamp multiple images in batches with simple text watermarks using either Irfanview or Exifer . Irfanview is a nice little utility program that I find essential for doing batch work. Both are free. AFAIK you can't add a nice image overlay with them in batches.

For doing a nice image overlay you'll either need a decent image editing application that supports batch processing or do it server side with GD or Imagemagick. If you're on shared hosting the latter is probably not an option as it will suck up a lot of resources if you're doing a lot of them.

Haven't tried to use it for it but you might also want to try the gimp for this, undoubtedly you'll find it will either out of the box or with a add-on.

-------------------

If you're trying to make the image unusable stamp the entire image with transparent mark that uses a gradient fill.