We have a group of 8 servers that share images with each other over about 2000 different domains. We are starting to have problems with people hot linking and using our images and so forth. I know how to make it so that hot linking is not permitted, but I want to be able to specify a list of IP addresses that hot linking is allowed from. We add new domains daily, so a list of domains would not be optimal. So in summary, is there a way to prevent hot linking, except a list of allowed IP addresses?
Are you also watermarking your images? I imagine that you're talking about a lot of them, if it's 2000 domains. But you can alter images on the fly with a php script, so it might be worth looking into that: http://www.php.net/manual/en/ref.image.php Another approach could be to move your images. Again, presumably you have too many to move manually. But with .htaccess mod_rewrite you could do this. This is an approach that might take some time to implement, because you would have to change all of the links on your existing websites. However, if you change all the links to the image folders to variables, it will take you just a couple of lines of code to move everything once you have it set up, and you could do this as often as you like. For instance, point to http://www.example.com/$imagefolder/image.jpg $imagefolder points to where the images really are through mod_rewrite, which you can change. Anything pointing to your old image folder can be redirected instead to an image of your choice, such as one with an anti-hotlinking message. Neither of these methods will prevent 100% of hotlinking, but each will make you less of a soft target, without having to enter thousands of domains into your .htaccess.
here below a default method to do exactly what you want 1. allow hotlinking from selected sites 2. deny hotlinking from all others below is a slightly modified code of my own rewrite protection. ( instead of deny hotlink ( F ) i replace hotlinked pics by a banner ) on top you define the file extensions you want to protect from hotlinking then you have a series of URLs/sites preceded by ! ! = that is the list of allowed sites below you have the regex for ALL sites and the rule is to deny access to listed file extensions. to replace hotlinked pics by a default file ( pic ) you could replace the last rule by allowed also are your OWN domains !!! as you can see I have allowed the major SE - but NOT their various IP-addresses.