Exclude one file from password protection in .htaccess

I have the following code to protect files with a password in .htaccess:

<FilesMatch "\.(html|htm|css|js|php|swf|swz|xml|ico|jpg|jpeg|png|txt)$">
AuthName "Member Only"
AuthType Basic
AuthUserFile /path/to/password/.htpasswd
require valid-user
</FilesMatch>

How can I exclude should_be_excluded.phppassword protection? I can change the guard lines if necessary, but I think something can be done in regex?

+5
source share
1 answer

what about something like:

<FilesMatch "\.(html|htm|css|js|php|swf|swz|xml|ico|jpg|jpeg|png|txt)$">
    AuthName "Member Only"
    AuthType Basic
    AuthUserFile /path/to/password/.htpasswd
    require valid-user
</FilesMatch>
<Files /should_be_excluded.php>
    Order Allow,Deny
    Allow from all
</Files>

should this allow ALL access to the excluded file?

+3
source

All Articles