How do I add multiple users and login credentials such that multiple users can access a directory with their specific credentials? Let's say I want them all to be able to access the directory /about/team/
.htaccess:
AuthType Basic
AuthName "Please enter the username and password"
AuthBasicProvider file
AuthUserFile /path/.htpasswd1
Require user user1
AuthType Basic
AuthName "Please enter the username and password"
AuthBasicProvider file
AuthUserFile /path/.htpasswd2
Require user user2
AuthType Basic
AuthName "Please enter the username and password"
AuthBasicProvider file
AuthUserFile /path/.htpasswd3
Require user user3
.htpasswd
user1: 123%%^sample-passwordHJGH&^
user2: 456%%^sample-passwordHJGH&^
user3: 789%%^sample-passwordHJGH&^
Thanks
Specify a single auth block and use Require valid-user
instead. For example:
AuthType Basic
AuthName "Please enter the username and password"
AuthBasicProvider file
AuthUserFile /absolute/file-path/to/.htpasswd
Require valid-user
Note that the file-path for AuthUserFile
is an absolute filesystem-path.
Reference: