.htaccessapachemod-auth

Referencing .htpasswd from accounts with different usernames


I push my website to multiple servers where I have different usernames. I want to have a .htaccess file that password protects a file regardless of which server I'm on.

The issue is that AuthUserFile only takes absolute paths, so if I have:

AuthUserFile /home/will/.htpasswd

I get a server error on a box where my username is wjholcomb (and home directory is /home/wjholcomb/).


Solution

  • .htaccess can have multiple AuthUserFile lines:

    AuthUserFile /home/will/.htpasswd
    AuthUserFile /home/wjholcomb/.htpasswd