Step1: Create a file under your project/site directory named with .htpasswd
Step2: Write down the username and encrypted password to the file .htpasswd
. Like bellow
your-username:encrypted-password-here
[note: password can be generated from here http://www.htaccesstools.com/htpasswd-generator/]
Step3: Put the bellow codes into your .htaccess file
ErrorDocument 401 "Unauthorized Access"
ErrorDocument 403 "Forbidden"
<FilesMatch "wp-login.php">
AuthName "Authorized Only"
AuthType Basic
AuthUserFile /home/cpanel-user-name/public_html/domain-name.com/.htpasswd
require valid-user
</FilesMatch>