How to prevent hotlinking without mod_rewrite


Sometimes you don’t have mod_rewrite at your disposal, and yet you want to prevent hotlinking.

Here’s how:

<FilesMatch "\.(gif|jpe?g|png|wmv|avi)$">
SetEnvIfNoCase Referer ^$ allow_access=1
SetEnvIfNoCase Referer ^http://(www\.)?wejn\.org($|/) allow_access=1
Order Deny,Allow
Deny from all
#Allow from all
Allow from env=allow_access
</FilesMatch>