Access Control Using Environment Variables

allow from env=VARIABLE
Allow access if environment variable is set.

deny from env=VARIABLE
Deny access if environment variable is set.

Typically used in conjunction with BrowserMatch, SetEnvIf, or with mod_rewrite module.

Examples

Block Access from Some Bad Robots

  BrowserMatch "^teleport pro" BadRobot
  BrowserMatch ^netattache     BadRobot
  BrowserMatch ^wget	       BadRobot
  BrowserMatch ^go-ahead-got-it  BadRobot

  <Location />
     order allow,deny
     allow from all
     deny from env=BadRobot
  </Location>

Block Access from People Linking to our Images

  SetEnvIf Referer "^http://www.cshl.org/" ReferredByUs
  <Location /artwork>
      order deny,allow
      deny from all
      allow from env=ReferredByUs
  </Location>

<< Previous Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Sun Jul 16 18:47:38 PDT 2000