Adding password protection to an area of a website is actually pretty easy. Basically all you need to do is create a subdirectory and to it add two files, .htaccess and .htpasswd.
Setting Up .htaccess
The .htaccess file defines access privileges and the location of the password file, .htpasswd. It should look something like the following example;
AuthType BasicAn important point to note. The variable AuthUserFile must be the full path name of your web space. This will likely not be your domain name. So you may need to contact your ISP to get that information. Alternatively search the ISPs FAQ.
AuthName "restricted area"
AuthUserFile /the-full-path-name-of-your-webspace/membersonly/.htpasswd
AuthGroupFile /dev/null
AuthName secure
AuthType Basic
require valid-user
order allow,deny
allow from all
Setting Up .passwd
The .passwd file contains users names and passwords. Nothing else. The passwords must be encrypted. Fortunately there is an abundance of free tools around the web for this task.
userName:passWord
No comments:
Post a Comment