Friday, December 15, 2006

Create password protection for web folder using .access

Two files need to be create: .htaccess and .htpasswd

Example:
I want to protect a folder call "test" (/usr/www/test)
user name: goodwill
password: hackit

Create a file called .htaccess, put it in /usr/www/test/ with these content

AuthName "Restricted area"
AuthType Basic
AuthUserFile /Usr/.htpasswd
AuthGroupFile /dev/null
require valid-user


Create a file called .htpasswd that contents user name and encripted password ( using htaccess generator:http://tools.dynamicdrive.com/password/ ), then put this file in /usr/

EX: goodwill:.l6wTNxfoHj6U (encripted hackit)

Browse to you site to see if it work