Customer Resource: How to password protect a Directory
The Apache web server allows you to password protect directories with the .htaccess and .htpasswd configuration files. If you would like to protect a directory on your site, please follow the instructions below.
Create a directory on the server
Use your favorite ftp client to create the directory you want to protect on the server. The directory has to be created in the directory tree under htdocs.
Example:
Let's say I want to protect a test directory. I would create this directory called "test" in "htdocs".

Creating the .htaccess file
First you will have to create the .htaccess file.
You should copy the lines below and save them as a plain text file with the name ".htaccess".
Please copy everything between the " BEGIN .htaccess " and " END .htaccess " lines:
----------- Begin .htaccess ---------
AuthUserFile /www/home/your_domain.com/htdocs/your_directory/.htpasswd
AuthName Protected-Area
AuthType Basic
<limit GET>
require valid-user
</limit>
----------- End .htaccess ---------
After you have copied these lines into a new text file, you will have to modify the AuthUserFile directive.
AuthUserFile:
Please replace "your_domain.com" with your domain name and "your_directory" with the name of the directory you want to protect. This directory has to be created beneath the htdocs directory.
Example:
Let's say my domain name is "anything.com" and my directory is called "test". Then my AuthUserFile directive would be:
AuthUserFile /www/home/anything.com/htdocs/test/.htpasswd
Finally, save the document as a plain text file and name it ".htaccess", (without quotation marks and in lower case). After saving, please verify that your text editor has not appended the file extension ".txt". You may have to rename the file from ".htacess.txt" to ".htaccess".
Creating the .htpasswd file
The next step consists in encrypting your password and creating the password file.
Please choose a username and password and use the form below to obtain your password hash.
Copy the line into a new text document and save it as ".htpasswd" (and again without quotation marks,in lower case, and no ".txt" file extension).
Example:
The password file entry for the user Bob would look something like this:
----------- Begin .htpasswd---------
Bob:axFAaXpmb81qQ
----------- End .htpasswd----------
For several users, just add their password hash, to the password file on a separate line.
----------- Begin .htpasswd ---------
Bob:axFAaXpmb81qQ
peter:99og8d/51IPt.
pierre:oMkE9ZNU1mASU
mark:VhMS7KdsN.rlc
john:E.DSv1KG/Bg/.
------------ End .htpasswd -----------
Upload both configuration files into your directory!
Now that you have created both configuration files, you have to ftp both files into the directory you want to protect. Make sure that you upload both files in ASCII mode, i.e. as text and not in binary. Also, make sure that the file names are indeed ".htaccess" and ".htpasswd", and that they are in lower case, no quotation marks, and without a ".txt" file extension.
If you try to access your directory now in your browser, you should be prompted for a username and password.

Voila, done!
Common questions!
Please find an example below.
----------- Begin .htaccess ---------
AuthUserFile /www/home/your_domain.com/.htpasswd
AuthGroupFile /www/home/your_domain.com/.passwd.group
AuthName Protected-Area
AuthType Basic
<limit GET>
require group groupname1
</limit>
----------- End .htaccess ---------
----------- Begin .passwd.group ---------
groupname1: user1 user2 user3
groupname2: user5 user6 user7
-------- End .passwd.group ---------
----------- BEGIN .htpasswd ---------
user1:axFAaXpmb81qQ
user2:99og8d/51IPt.
user3:oMkE9ZNU1mASU
user5:VhMS7KdsN.rlc
user6:E.DSv1KG/Bg/.
user7:H8kfR3.iP6V
------------ END .htpasswd -----------
----------- Begin .htaccess ---------
<Limit GET>
order deny,allow
deny from all
allow from .allstream.com
allow from 216.209.194.135
</Limit>
----------- End .htaccess ---------
In this example, all access is denied to all browsers in the third line, then the next two lines allow access from any browser from "allstream.com" and from the IP "216.209.194.135".