Posted By

HeWo42 on 02/28/09


Tagged

htaccess hotlinking leeching bandwidth


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

AshMan


PREVENT HOTLINKING


 / Published in: Apache
 

SESSIONNAME = Name of your session cookie; example.com = Domainname of your site

  1. RewriteEngine On
  2.  
  3. ## PREVENT HOTLINKING ###
  4. SetEnvIfNoCase Cookie SESSIONNAME=(.*) IS_OK
  5. SetEnvIfNoCase Referer "^http://(www\.)?example\.com(/.*)?$" IS_OK
  6. #SetEnvIfNoCase Referer "^http://(www\.)?example\.net(/.*)?$" IS_OK
  7.  
  8. <FilesMatch "\.(avi|bmp|flv|gif|jpe?g|mov|mp(3|4|e?g)|png|swf|tiff?|wm(a|v))$">
  9. Order deny,allow
  10. deny from all
  11. allow from env=IS_OK
  12.  
  13. ErrorDocument 403 http://127.0.0.1/
  14. </FilesMatch>

Report this snippet  

You need to login to post a comment.