Is there any way to dynamically determine which htpasswd file to use at runtime? For example, the following (which does not work, just an example) inside a VirtualHost context:
RewriteEngine on
RewriteMap htpasswdfiles txt:/srv/htpasswdfiles/htpasswdfiles.map
RewriteCond %{HTTP_HOST} ^(.*)$
RewriteRule .* - [E=PASSWD_FILE:${htpasswdfiles:%1},L]
<Directory /some/path>
AuthType Basic
AuthName "Restricted Access"
AuthUserFile $PASSWD_FILE
Require valid-user
</Directory>
I know the above example doesn't work, but i'm not sure if there's a different way to use environment variables like this... If not, i don't know if there would be any other method to choose the htpasswd file dynamically at runtime. htpasswdfiles.map would be a map containing domains on the left and the appropriate htpasswd file paths on the right.