Folder password protection using htaccess

With htaccess it becomes very easy to protect a folder or directory and this method is simply referred to as “htaccess authentication”. In order to protect your folder password with htaccess , you need to upload two files; .htaccess and .htpassword within the directory in which you want to password-protect, if you have not these files on your server, you can create new ones using Notepad just make a new file and save it without name just .htaccess extension, and set file type as All Files as the following image.

create a new htaccess file using Notepad

In order to use htaccess to protect a folder password , you need to use the following commands;

AuthType Basic
AuthName “Password Protected Area”
AuthUserFile /path/ to/ .htpassword
Require valid user.

All these components are already in the htaccess file and all you need to do is to change the “path/to/.htpassword/ and choose the password you want to use. The next step is to upload the .htpassword file that contains both the username and password and then you can enter the password protected file. You may need to use a password generator to create another password for the file but you must keep in mind that each line of the .htpassword command will have a different combination of username and password.

Comments
  1. No comments yet!, be the first to post a comment.

Your email will not be published, The required fields marked with '*'

*