You need to create a folder you wish password protected.
Then create an .htaccess file pointing to the .htpasswd file
You can create both in notepad.
Create your .htaccess file similar to the following:
Code:
# This is a comment, it is ignored by Apache due to the # character
# The next line must contain the FULL filepath to the folder on your server. You'll need to find this yourself.
AuthUserFile /home/sitename/public_html/private/.htpasswd
# Next line leave as is
AuthType Basic
# Next line just tell's the visitor the folders protected
AuthName "This is a password protected folder"
# Next line leave as is
Require valid-user
You can remove all the lines with the # comment tags if you wish. Getting the correct path is the hardest part.
Now create your .htpasswd file.
Code:
# Each user needs to be placed on a new line. The first part is the username followed by : followed by the encrypted password.
egg:$apr1$QLKsuqXJ$ju51MZCwWdUJEM5IQGmwd1
# The encrypted line is created by an on-line generator link given below
Upload both these files to the folder you wish to password protect.
I find it best to name the files htaccess.txt and htpasswd.txt on the local computer then rename them .htacces & .htpasswd on the on-line server after upload.
You can test it out HERE and use the username egg and password egg
You can use an on-line generator like HERE
For more details view HERE
Bookmarks