Forum Moderators: phranque

Message Too Old, No Replies

.htaccess code for hotlinking not working why?

         

ElvisFan

2:15 am on Jan 8, 2006 (gmt 0)

10+ Year Member



okay... I have created a .htaccess code and added an image to load should yet another thief steal my images... I have about 10 images stolen every other day... and I spend most of my time renaming my images... so decided that maybe adding a .htaccess code would save me a lot of trouble

Now the trouble is... I can't seems to make it work.... I have read just about everything there is on the subject... but they omit to tell you how to load and where to load.. both the .htaccess code and the refer image.

Please can someone shed some light on this issue...

If I drop my .htaccess code in my images directory... where do I drop my image url... as the image does show in the browser

but alas it doesn't work to stop hotlinking to images on my site.

Help, please .... thanks

[edited by: jdMorgan at 6:07 am (utc) on Jan. 8, 2006]
[edit reason] No URLs, please. See Terms of Service. [/edit]

jdMorgan

6:51 am on Jan 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ElvisFan,

You can put the code in your top-level-Web-accessible directory, or in any directory that is below that in the path to the image-storage directory, or in the image storage directory itself. Remember that the URL 'seen' by RewriteRule is 'localized' to the directory where that rule runs, though.

I don't I understand your question about 'dropping the image URL' at all , though. "Dropping a URL" is why your first post in this thread got edited -- that's the only meaning I'm aware of... ;)

Maybe you're asking this...
Your replacement image should be outside of the protected directory, unless your code has an exclusion that allows it to be shown to hotlinkers. Either method is fine and will work.

Jim

FrostyMug

7:28 am on Jan 8, 2006 (gmt 0)

10+ Year Member



there are great online sources for managing image hot linking with htaccess. make sure the image is .png extension. here's my sample:

RewriteEngine On
RewriteCond %{HTTP_REFERER}!^http://(www\.)?yoursite\.com [NC]
RewriteCond %{HTTP_REFERER}!^$
RewriteRule \.(gif¦GIF¦jpg¦JPG)$ /replaced-image-leeching-image.png [L]