Hello techies,
I use this for testing my website which is live but have to test something with some selected users, so i will share my experience with you all here.
We have to work on just two files one is .htpasswd and second one is .htaccess
In .htpasswd we have to add just one line of code depending upon how many logins you create using this https://hostingcanada.org/htpasswd-generator/ and paste that code in your .htpasswd file
Then in .htaccess file you have to add some lines of code
AuthName "Add your login message here."
AuthType Basic
AuthUserFile /home/*** full path from root ****/public_html/.htpasswd
require user name-of-login-user-you-created-in-htpasswd-file