How to set up .htpasswd in a site ?

Step 1 : create file .htpasswd and put out side our root folder but inside www for safety.

Step 2 : open the file .htpasswd and add like username:password -> then save and close. So now file contains


Step 3 : Add the following in .htaccess file

AuthName "Restricted Area"
AuthType Basic
AuthUserFile D:/wamp/www/.htpasswd # full path to .htpasswd file
AuthGroupFile /dev/null
require valid-user


Now open you site http://mysite.com
It will ask username and password to display.

Use this functionality in all admin side. It will block all hackers.

Posted by : Shijith Nambiar