htaccess allow if does not contain string

Posted by Tom on Server Fault See other posts from Server Fault or by Tom
Published on 2010-04-29T09:32:22Z Indexed on 2010/04/29 9:37 UTC
Read the original article Hit count: 262

Filed under:
|
|

I'm trying to setup a .htaccess file which will allow users to bypass the password block if they come from a domain which does not start with preview. e.g. http://preview.example.com would trigger the password and http://example.com would not.

Here's what I've got so far:

SetEnvIfNoCase Host preview(.*\.)? preview_site
AuthUserFile /Users/me/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
AuthName "Development Area"
Require valid-user
Order deny,allow
Allow from 127
deny from env=preview_site
Satisfy any

Any ideas?

© Server Fault or respective owner

Related posts about htaccess

Related posts about apache