Support - Knowledge base

Giving you the answers you need

Why not try our knowledge base for instant help and advice to enhance your online experience with Register365? From within the knowledge base you can browse our frequently asked questions and find the right answers to help solve your queries.

Home  >  Scripting  >  Rewrite Scripts  >  View Article

How to prevent other people from stealing images.

3*3*3*3*3*

Article

Tradionally, under Linux, anti-image leeching routines are done using mod_rewrite and a .htaccess file.

Under the Zeus webserver, you can now do this using the rewrite.script feature on our Linux hosting packages. Below is an example of what to place in the rewrite.script file, which needs to be uploaded to your web directory.

Please note: lines beginning with a # are comments, and words in italics should be replaced with your domain name etc.

RULE_0_START:     
# This is a list of image file extensions to check against      
  insensitive match URL into $ with \.(gif|jpg|jpeg|png)$   
  if not matched then goto RULE_0_END     
# Check the incoming site referer value      
  set SCRATCH:COND = %{IN:Referer}     
  match SCRATCH:COND into % with ^$     
  if matched then goto RULE_0_END     
# This site here is allowed to display images from your site      
  set SCRATCH:COND = %{IN:Referer}     
  insensitive match SCRATCH:COND into % with ^http(s)?://(www\.)? allowed.site1.com     
  if matched then goto RULE_0_END     
# This site here is allowed to display images from your site      
  set SCRATCH:COND = %{IN:Referer}     
  insensitive match SCRATCH:COND into % with ^http(s)?://(www\.)?allowed.site2.com     
  if matched then goto RULE_0_END     
# This image here is allowed to be displayed (your "do not leech" image)      
  set SCRATCH:COND = %{URL}      
  insensitive match SCRATCH:COND into % with ^/images/noleech.jpg     
  if matched then goto RULE_0_END     
# This is the full url to your "do not leech" image      
  set URL = http://www.my-domain-name.com/images/noleech.jpg     
  set RESPONSE = 302     
  set OUT:Location = %{URL}      
  set BODY = Please try <a href="%{URL}">here</a> instead      
  goto END      
RULE_0_END:

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed