Web access control
The following procedure will enable you to restrict web access to some of the directories within your website e.g. You might want a directory that only certain members can view.
In operation if a web user tries to access any page/file in the protected directory they will be asked to provide a username and password that must match those you have created. The user will only be asked once per session for this information.
Create the following four-line file and call it .htaccess (the leading dot is important) and place in the directory requiring access limit protection. (It will also protect any directories under it in the same manner, unless they have a .htaccess file, in which case its controls will come into effect.)
| AuthUserfile /webalias/sitename/passdir/passfile AuthName Password AuthType Basic require valid-user |
Where sitename = the name part of your domain i.e. acme (if www.acme.co.uk).
Note: Websites on vweb17 and above (the new automated unix servers), sitename is the full main URL i.e. www.acme.co.uk [not acme].
Where passdir = name of directory (in your FTP root [above public]) to place password files
Where passfile = name of password file i.e. webpasswd or .privpasswd
| Example for www.acme.co.uk
AuthUserfile /webalias/acme/pdir/webpasswd |
The passfile file should look like this (a line per user) [username:encrypted passwd] and be in the passdir. As per the example we recommend the passdir is in the root of your FTP i.e. the same level as the public and logs directory. cambridge:ukVU1NZypV4/A chrisarnold:b9aCxtyZTUcSg. To generate the encrypted lines go to Opal's Password Generator.
Enter username and password and then hit the form enter button from the resultant page. Copy the required line into your local copy of the password file and when you have finished FTP it up to the passdir on your website. [You may like to find your own htpasswd generator].
Remember to use a simple text editor (like Notepad) to create your password file.
If you would like to add further users in the future just take the encrypted line and add it to the end of your passwd file, or delete the line to remove them.
Note: If you want to modify ones that Opal has created (or in the data directory), we may have to change permissions as we normally leave them as root ownership.


