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.
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
The .htaccess file should look like the following
AuthName "admin only"
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.