PREVENT HOTLINKING


/ Published in: Apache
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.