How to make your website password protected using .htaccess? 10Dec, 2010

How to make a website password protected in just 2 minutes? It’s simple.

Here, we will be using .htaccess to authenticate our valuable stuff on the web. Thus to achieve the same follow the below mention 3 simple steps.

  1. This whole process, will require us to create two files (.htaccess and .htpasswd) and have to put them on FTP under the folder to which we would like to make password protected.
  2. .htaccess – Below is the code for .htaccess file
    AuthUserFile /home/domains/ [path to .htpasswd file]
    AuthType Basic
    AuthName "Warning: This is a restricted area..."
  3. .htpasswd – In this file, we need to mention the username and password using which one can login to restricted area.
    Username:passwordPlease note: we must encrypt the password, afterall it’s password ;)Now, you must be wondering that how to encrypt the password. Don’t worry, there are many websites available on the net that converts your password into encrypted form. For instance: – Here, you just input your username and password and they will give you a string (user/pass in encrypted format). Copy paste that string into your .htpasswd file and upload it and you are done. Yes, that’s it.
Posted by: Ramandeep Singh / In: Apache, Security and Tagged , , ,

One thought on “How to make your website password protected using .htaccess?”

Comments are closed.