In order to do that you need to do 2 things:
1) Edit .htaccess file
2) Generate sh1 hash key for your password.(use this page to generate sh1 passwosh hash)
2) Add it to .htpass file (all user and hashed-password) and upload to server.
1) Add the following lines to your .htaccess file:
1 2 3 4 5 6 7 8 | AuthType Basic AuthName "restricted area" AuthUserFile /home/www/public_html/dir-to-protect/.htpass require valid-user |
2) Create .htpass file with the following format and upload it to the same folder you want to add protection to:
1 2 3 4 5 6 | username1:sh1(password1) username2:sh1(password2) |