Start by opening Notepad and pasting this into the blank document:
USERNAME represents the username for your FTP. DIRECTORY_TO_PROTECT represents the subdirectory you are protecting with a password, and where you will be uploading .htaccess and .htpasswd to.
Code: Select all
# Access file order allow,deny allow from all require valid-user Authname "DirectoryName" Authtype Basic AuthUserFile /usr/www/USERNAME/DIRECTORY_TO_PROTECT/.htpasswd
Save that to your hard drive under the name ".htaccess" (no quotes).
Next, open up Notepad again with a new document. For each person you want to have access to your password-protected directory, you must add the following line:
LOGIN_NAME represents the name they will use to login, such as "Bob". HASHED_PASSWORD is the password you want them to have, which has been run through a special filter to change it to a different form. To apply the filter, visit this page and type in the password to give them: https://www.nfoservers.com/passcreator.pl. It will output what the password hashes to; copy that string (everything after the colon on the first line, including any periods or other odd characters) into Notepad as HASHED_PASSWORD.
After you've added all the users and their passwords, save that file to your hard drive as ".htpasswd" (no quotes).
Then, simply upload .htpasswd and .htaccess into SUBDIRECTORY_TO_PROTECT on your free webspace. That directory and all subdirectories will be instantly password-protected!