4

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/).

dysbulic
  • 3,005
  • 2
  • 28
  • 48

1 Answers1

5

.htaccess can have multiple AuthUserFile lines:

AuthUserFile /home/will/.htpasswd
AuthUserFile /home/wjholcomb/.htpasswd
dysbulic
  • 3,005
  • 2
  • 28
  • 48
  • 2
    If the first file on the list doesn't exist, internal server error occurs. So, how to deploy one `.htaccess` file on different servers then? – TheFrost Nov 28 '14 at 01:49