Pass the image thorugh a php file, watermark it or check the referer & if not your website, send an image saying "Don't rob my images".
Can anyone tell me how to add an exception for hotlinking images? I have something like the below on my .ht access file:
#RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
I was figuring if I wanted an image called image.png to be hotlinked then the code would look something like this:
#RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$ [NC]
RewriteCond %{REQUEST_URI} !^http://mysite.com/image.png$
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
This doesn't seem to work though. Anyone out there able to help or point me in the right direction? It's driving me nuts.
Last edited by andywozhere; 31-10-2009 at 09:37 PM.
Pass the image thorugh a php file, watermark it or check the referer & if not your website, send an image saying "Don't rob my images".
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Car Parts & Accessories Car Parts
:. Cars Ireland Cars Ireland
:. I Have 2 Find It Directory SEF Directory
It's just a free icon for Google Maps from another site... I just didn't want to use up their bandwidth (or in case they moved the images), so I thought I'd put it up on my own site. I didn't think it would end up being this complicated (although that could just be me).
For convenience sake I just hotlinked to the source website for the moment. They seemed to be cool with it so who am I to argue. Next time I will try and pass images via php as Louie suggested (thanks)... I would like to have more control of images in case the other website goes belly up or due changes in image locations.