Securing Your Web-Site with .htaccess


1. Under your public_html create the test directory: protected

   i.e. mkdir ~/public_html/protected

2. cd into ~/public_html/protected and create the file: .htaccess

   It should contain the following lines:

   AuthType Basic
   AuthName "Please supply password"
   require valid-user
   AuthUserFile /cs/htuser/username/auth/PasswordFile 

   Note: Replace "username" with your real username

3. cd /cs/htuser/username
   mkdir auth
   chmod 711 auth
   cd auth

4. Finally type the command: htpasswd -c passwdfile username
  
   e.g.  htpasswd -c PasswordFile Jerry

   Supply a password for the user Jerry. Notice that the passwdfile
   location must match what is in .htaccess under AuthUserFile. 
   

5.  chmod 644 PasswordFile

6. Go to ~username/protected 
   and login as Jerry