How To Create Apache htpasswd file -
How To Create Apache htpasswd file
This just simply outputs what you need a username and password that can be used to authenticate from .htaccess
htpasswd -nb user password
If you want to write it straight to a file
htpasswd -cb /tmp/somefile.pw user password
How To Use This In .htaccess
#make sure you require a user!