.htpasswd and .htaccess generator: .htpasswd file location

You need to specify the .htpasswd file location in the .htaccess file:

AuthUserFile /home/vhost/yourdomain.com/path/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Access"
AuthType Basic
require valid-user

For security reasons always place the .htpasswd file outside your docroot.
AuthUserFile requires the absolute path starting from the root ("/" or "C:/") of the webserver.

If the webserver is running on a Windows environment the AuthUserFile will look like: C:/home/vhost/yourdomain.com/path/.htpasswd