Wednesday, September 12, 2012

Password Protect Directory using .htaccess

1) Create new .htaccess
and write below code in the .htaccess file.

AuthName "Section Name"
AuthType Basic
AuthUserFile /home/username/.htpasswds
Require valid-user

2) Create new .htpasswds file for username and password.


above syntax will be used for all the site including sun directories.

and if you want to protect only single ditectory then write below syntax instead of above syntax.

You must have to use the encrypted password in .htpasswds file.

Create encrypt password using below link