07-15-04 11:00 PM
Using Apache 2.0 I'm attempting to require user validation for access
to files in a directory "except" those with a ".txt" extension. I've
tried all kinds of "regular expressions" in the "FilesMatch" directive
in the .htaccess file, some with limited success.
I thought <FilesMatch "!(\.txt$)"> would yield a match for all files
that do not end with ".txt". This does not work; however, if I use
<FilesMatch "\.txt$"> I can match all files that do end with ".txt".
What I have found is that whenever I use the "!" in a regular
expression I do not get the results I'm expecting. Is the use of
regular expressions in <Files> and/or <FilesMatch> limited such that
"!" is not going to work?
I've tried getting this to work using Apache 1.3 and Apache 2.0 on
both Win32 and OpenVMS systems.
I'd appreciate some direction on this one. My .conf file and
.htaccess files follow.
Thank you.
My joe.conf file includes...
<Directory "C:/Apache/test" >
Options Indexes Includes ExecCGI MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Alias /test "C:/Apache/test"
<Directory /test/userdir >
AllowOverride None
Options Indexes MultiViews
</Directory>
#
# Require username/password
# (defined in C:\Apache\test\userdir1\.htaccess)
#
<Directory /test/userdir1 >
Options Indexes Includes MultiViews
AllowOverride AuthConfig
</Directory>
My C:\Apache\test\userdir1\.htaccess file contains...
AuthType Basic
AuthName "The Big Authority"
AuthUserFile "C:/Apache/joespasswords.txt"
<FilesMatch "!(\.txt$)">
require valid-user
</FilesMatch>
[ Post a follow-up to this message ]
|