htaccess secure directory tool generates code for the .htpasswd and .htaccess files to protect a directory.
:
AuthType Basic AuthName "Password Protected Area" AuthUserFile Require valid-user
Enter username, password and path to the .htpasswd file. The path should be relative to the root directory of your server. Click generate to generate .htpasswd and .htaccess code. The htaccess secure directory tool will generate code for both .htpasswd and .htaccess files. Create those files and copy paste the code in the files. Then upload the .htaccess file in those directories which you want to protect. Upload the .htpasswd file in a directory as you mentioned in the .htpasswd path input. And finally, visit the directory to check if it is working.