Sunday, July 19, 2009

Apache: Enable access to the file in the directory protected with .htaccess

To protect our QA Apache web server from spammers with basic authentication, we use following .htaccess access file in the root directory of the web server:
AuthUserFile /secure-folder/.htpasswd
AuthGroupFile /dev/null
AuthName "Password Protected Area"
AuthType Basic
<limit GET POST>
require valid-user
</limit>

Now if you want to provide access to the file(s) in the sub directory below you should create separate .htaccess file for that sub directory and use Satisfy directive

<FilesMatch "^you-file-name$">
allow from all
Satisfy Any
</FilesMatch>

No comments: