You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by nf...@vsol.net on 2001/12/14 02:49:49 UTC
Answer: How to negate regular expressions in FilesMatch/.htaccess
Hi!
I wanted to have a directory where all files are password protected
except for a couple.
I spent quite a bit of time looking for something that would look like:
<FilesMatch ! "public_access.cgi">
require valid-user
</FilesMatch>
or:
<Files !~ "public_access.cgi">
require valid-user
</Files>
It can't be done that way, as far as I can tell, but I did come up with a
workaround:
AuthUserFile .htpasswd
AuthGroupFile /dev/null
AuthName "Staff"
AuthType Basic
<Files "*">
require valid-user
</Files>
<FilesMatch "^(public_access|passwd|mailcfg|viewmailcfg).cgi$">
Allow from all
Satisfy any
</FilesMatch>
Note, this example is the .htaccess file in that directory.
Just thought I'd share it, so that I can find it when I use
Google to go looking for these keywords again. :-)
Keywords:
Negative regular expressions, negating regular expressions, Apache,
excluding matches, excluding files, access, authentication.
--
N Fudd -- nfudd@vsol.net
This is a crisis. A large crisis. In fact, if you've got a moment,
it's a twelve storey crisis with a magnificent entrance hall,
carpeting throughout, twenty-four hour service and an enormous sign
on the roof saying `THIS IS A LARGE CRISIS'.
Captain Edmund BlackAdder
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Answer: How to negate regular expressions in FilesMatch/.htaccess
Posted by nf...@vsol.net.
On Fri, 14 Dec 2001, darren chamberlain wrote:
> nfudd@vsol.net <nf...@vsol.net> said something to this effect on 12/13/2001:
> > I wanted to have a directory where all files are password
> > protected except for a couple.
>
> I think you're our of luck. A few times in the past, I've lost a
> lot of hours trying to figure this out, and nothing ever came of
> it.
>
> BTW, my solution ended up being to install mod_perl and define
> the Location directives using Perl syntax.
Actually, I found a way; that was what was posted. I'm sure it could
be simplified, but I was posting a questionless answer.
--
N Fudd -- nfudd@vsol.net
In a free and open marketplace, it would be surprising to have such an
obviously flawed standard generate much enthusiasm outside of the criminal
community. --Mitch Stone on Microsoft ActiveX
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Answer: How to negate regular expressions in FilesMatch/.htaccess
Posted by darren chamberlain <dl...@users.sourceforge.net>.
nfudd@vsol.net <nf...@vsol.net> said something to this effect on 12/13/2001:
> I wanted to have a directory where all files are password
> protected except for a couple.
I think you're our of luck. A few times in the past, I've lost a
lot of hours trying to figure this out, and nothing ever came of
it.
BTW, my solution ended up being to install mod_perl and define
the Location directives using Perl syntax.
(darren)
--
People who are willing to give up freedom for the sake of short
term security, deserve neither freedom nor security.
-- Ben Franklin
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org