Important:Access restriction applies to a certain directory, not a certain file or HTML document. Documents that are to be restricted should be put in directories separate from those you want unrestricted.
A .htaccess file must be created in the directory that the user wants to secure. (Multiple directories can have .htaccess files, but there can only be one .htaccess file per directory.)
While in the directory you want to secure, edit a file called .htaccess using your favorite text editor.
The .htaccess file contains 2 sections:
AuthUserFile {path to .htpasswd file}
AuthGroupFile {path to .htgroup file}
AuthName {title for dialog box}
AuthType Basic
<Limit GET>
{access instruction to be executed}
</Limit>
Unix file permissions for the ".htaccess" file must be set so that everyone (ie. owner,group, and other) has read permissions.