How to password protect a web site
There are a number of ways to prevent people accessing directories on or your entire web site. One of the most secure is using a .htpasswd file- Create a file - .htpasswd - with the username and password for the directory you want to password protect
- Open it, and make up a username and password. Put them both on one line, separated with a colon. There shouldn't be any spaces
- You must encrypt the password. Here is a site to help you: http://home.flash.net/cgi-bin/pw.pl
- Now create a .htaccess file in the directory you want to protect, and add this to it:
AuthUserFile /home/user/www/.htpasswd
AuthGroupFile /dev/null
AuthName "User"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
You need to change the first line to reflect the location of your .htpasswd file - Now when you go to the directory, you will be asked for your username and password before you can access the protected directory