Preventing Image Hotlinks With Apache Configuration Files
27 10 2006As always, this is more a reminder to me than a ‘How-To’ - For ages I’d been meaning to stop certian sites from embedding images from my servers directly into their pages but I kept forgetting and also didn’t know exactly how to stop it. I found the time and inclination last night and turned to the apache manual…
<FilesMatch ".(gif|jpg|png)"> SetEnvIfNoCase Referer "my.domain.co.uk/" local_ref=1 Order Allow,Deny Allow from env=local_ref </FilesMatch>
Pretty simple huh?
As I’m sure you can work out, if you have multiple domains all pointing at the same space you just need to add more regular expressions:
SetEnvIfNoCase Referer "my.domain.co.uk/" local_ref=1 SetEnvIfNoCase Referer "my.domain.com/" local_ref=1 (...etc)





