Make a password protected Website just in 2 steps.

by · August 17, 2012

Make a password protected Website with .htaccess and .htpasswd file

Now you can protect your website by password. So that you can limit the website access from anonymous web users.

This increases your web security. This is done by .htaccess and .htpasswd file on your web server. This is treated as web Locker with .htpasswd file contains the key of locker.

password protected

.htaccess:  .htaccess file contains the path of .htpasswd file, authentication type, authenticated user name.

Create a new .htaccess file and place the following code in it:

AuthUserFile /usr/local/you/safedir/.htpasswd

AuthGroupFile /dev/null

AuthName EnterPassword

AuthType Basic

require user admin



AuthUserFile contains the full path of server where .htpasswd file exists.

require user contains the name of the authenticated user. Who is able to access the website.

AuthType Basic is used because we use basic HTTP authentication.



.htpasswd: .htpasswd file contains the username and password which is placed in encrypted form. You can encrypt the username and password here( ).

Tip:  Don’t Place your .htpasswd file in your root directory. Please put this file in your safe folder like usr/local/you/safedir/.htpasswd

the .htpasswd file would look like this:



If you have any questions about this post please comment or mail us at

VN:F [1.9.22_1171]
Rating: 9.8/10 (4 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)
Make a password protected Website just in 2 steps., 9.8 out of 10 based on 4 ratings

You may also interested in: