Hotlinking protection custom code – not working
-
Hi,
Just trying to get image hotlinking protection enabled on my website and came across the custom code on your main BPS website here:
https://forum.ait-pro.com/forums/topic/hotlink-protection-do-not-block-google-bing-or-yahoo/I’ve added the following code to the bottom box in the root htaccess custom code page entitled “CUSTOM CODE BOTTOM HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE: Add miscellaneous code here”.
# Prevent hotlinking of images (but allow search engines) SetEnvIfNoCase Referer "^(http|https)://.*mywebsite.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*myotherwebsite1.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*myotherwebsite2.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*myotherwebsite3.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*google.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*yahoo.*" whitelist SetEnvIfNoCase Referer "^(http|https)://.*bing.*" whitelist # SetEnvIf Server_Addr "^123\.123\.123\.1$" whitelist <FilesMatch "\.(gif|jpg|jpeg|png|bmp)$"> Order Allow,Deny Allow from env=whitelist </FilesMatch>
However this does not seem to be working – any ideas why this is please?
I have the server address line commented out at the moment as I’m not sure whether the final part of the numeric server address should just be the first digit (is the $ a wildcard) or whether it should be the full 3 digital number.
I used the the above format for the first ‘mywebsite’ address line as I have both .com and .co.uk versions of the same domain so wanted to allow both. Is that the correct way to do it?
- The topic ‘Hotlinking protection custom code – not working’ is closed to new replies.