Generate .htpasswd Create password file for basic authentication

Generate .htpasswd for basic authentication

Paste the output string into an .htpasswd file for use.

username
password
Basic authentication is often used when you want to add browsing permissions to a website easily.
If you want to temporarily block a website from being viewed until the day it is released to the public, and you want to allow only relevant people to view it, this is a good way to do it. This is useful in such cases.
It can be achieved by simply writing the default entry in .htaccess and the string created for this site in .htpasswd
The contents of .htpasswd are as follows.
admin:42ZhqOgeFPmuA
The format is "username:password", in this case the username is "admin" and the password is "pass".
The password "pass" is hashed to get the string 42ZhqOgeFPmuA.
The hashed string can be easily obtained with php's crypt function.
<?php print crypt('pass','aa'); ?>
The 'aa' part is given as an arbitrary two-character string.
It is also possible to write multiple accounts in .htpasswd
alexa:8tiYC3FVuPLxQ
barbara:a7t1wganOp6/E
chris:kmzk6Qqs.roh2
The .htaccess file should look like the following
AuthUserFile /home/www/sitename/.htpasswd
AuthGroupFile /dev/null
AuthName "admin only"
AuthType Basic
require valid-user
You can use it freely for both commercial and personal use.
This article is current as of November 2013
If you have any questions about this site, please contact ao-system
We shall not be liable for any claims for damages incurred in the operation of this program, regardless of whether or not there is any negligence in the use of this program.