I have protected my website with .htaccess file with one user, script that i use in below
.htaccess :
ErrorDocument 401 "Unauthorized Access"
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
AuthType Basic
AuthName "domain-name.com"
AuthUserFile "/home/path/.htpasswds/domain-name/passwd"
require valid-user
passwd :
user1:password1
How to add multiple users? I have tried as below and not success.
user1:password1
user2:password2
Please assist me in this, thanks in advance
First you need to create the htpasswd file in your home directory using the htpasswd command. SSH into your directory and enter:
htpasswd -c .htpasswd userone
Enter password for userone twice.
For multiple users, repeat the command without the -c
htpasswd .htpasswd membertwo
Thats all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With