Friday, January 31, 2014

password protected folder on Apache with the help of .htaccess and .htpasswd file

.htpasswd file
The following code will be include in your .htpasswd

Admin:prplaCMT5hYjo

This is your login credential while browsing that directory. The password is encrypted with md5


Upload this file in that directory you want to password protect.

.htaccess

The following code will be include in your .htaccess

AuthType Basic
AuthName "restricted area"
AuthUserFile /home/path/public_html/dir_name/.htpasswd
require valid-user

Upload this file in that directory you want to password protect.