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.
- 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.
- .htaccess – Below is the code for .htaccess file
AuthUserFile /home/domains/xyz.com/.htpasswd [path to .htpasswd file]
AuthName "Warning: This is a restricted area..."
- .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: http://www.kxs.net/support/htaccess_pw.html – 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.