SetEnvIf Referer "^http://www.example.com/" local_referal # Allow browsers that do not send Referer info SetEnvIf Referer "^$" local_referal Order Deny,Allow Deny from all Allow from env=local_referal
Most web servers provide a simple way to serve images that only originate from referrers that contain your site. For EX. Apache one of the most popular web servers has a module called MOD_REWRITE.
If you have found a solution for another web server please let us know so we can post it here. - Updated: October 22, 2001
Yes simply put the directory /no-serve/ in front of your images. We will break al URL's containg that string. So simply put your images in a directory that looks like this.
/content/no-serve/dirtypics
In order to protect your content from hot-linking under Apache, you first need to have mod_rewrite enabled (either compiled in, or linked dynamically), and then you need to add the following to your .htaccess file:
Here is an explanation of the cryptic lines in the config code above: The first line turns on the rewriting for this config. The second and third lines specify conditions under which the rule will match – in this case if the referrer isn't blank and doesn't contain "chatropolis.com", "interfun.net", or "XXX.XX.XXXX.XX" (case insensitive because of [NC]). The last line specifies a regexp to do the actual rewriting. In this case, any URL with gif or jpg gets rewritten to read /images/can_not_display_image.jpg.