Forum Moderators: phranque
However, here are some recommended tweaks:
RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example\.com [NC]
RewriteCond %{REQUEST_URI} !/getyourown.jpg$
RewriteRule \.(jpe?g¦png¦gif)$ getyourown.jpg [NC,R,L]
Like all HTTP_REFERER-based methods, this is not 100% effective. It cannot protect against direct type-ins, JavaScript image preloads, and requests coming from corporate or ISP caching proxies. For more effective protection, you need to save the images in non-Web-accessible filespace, and force all image requests to go through a script that checks a cookie set by a page or pages on your site to 'authorize' the image access. Alternatively, you could also use a script that renames the images or the image directory periodically.
Generally, HTTP_REFERER anti-hotlinking is acceptably effective if the scripts are simply being hotlinked casually, but not if they are being intentionally stolen. This is because enough hotlinking requests will fail to make the users of the hotlinking site complain to that Webmaster that the image is broken to discourage that webmaster from keeping the image linked.
Jim