Password protecting your site using .htaccess / .htpasswd

1. Update .htaccess file to the root of your site with the following content:

AuthName "Authorisation Required"
AuthUserFile "/path/to/.htpasswd"
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"
2. Create & upload the .htpasswd file to ‘AuthUserFile’ path with the following content:
foo:$testing$f#$ffgJHFjhfRGV.
3. generate about line using username & password uaing this site http://www.htaccesstools.com/htpasswd-generator/