|
||
You will need to create the files htpasswd.html, htpasswd.cgi and .htaccess. All three files will go into the directory you're protecting and will do the password protection. Below follows instructions on how to create and use them.
<form action="htpasswd.cgi" method="post">Save the document as "htpasswd.html". Now you'll need to upload the htpasswd.html file to your website. You should have already made a directory on your website where the protected files are going to go, so upload the htpasswd.html into that directory. Make a note of the protected folder name on your website for future reference.
Username: <input type="text" size="30" name=username>
Password: <input type="password" size="30" name="password">
<input type="submit" value="submit">
If you don't have your own domain name on your site (for example if your site is called something like "sd.znet.com/~myname") then change the section to read: "/var/home/m/y/myname/public_html/LOCATION_OF_PROTECTED_FOLDER/.htpasswd" (substitute "myname" with the real site login name, "m" with the first initial of the login name, "y" with the second initial of the login name, and the "LOCATION_OF_PROTECTED_FOLDER" with the real folder location).
AuthName "My Website"Or an alternate AuthUserFile line:
AuthType Basic
AuthUserFile /var/domain/www.mydomain.com/private_stuff/.htpasswdrequire valid-user
AuthUserFile /var/home/myname/public_html/private_stuff/.htpasswdNow FTP the .htaccess file into your protected directory and you are finished. If you want to add more usernames and passwords for the protected directory, just go to your htpasswd.html page in your browser again and use it to add more (that page and the directory it is in will now be password protected with the initial username and password you assigned).
Troubleshooting
NOTE: If you are on a Windows machine and using Notepad for your text editor, Windows will by default add a .txt extension to the end of your file name (i.e. .htaccess.txt). If the file has a a file extension, the web server will not use it and it will not work. In order to prevent Windows from adding the .txt to your filename, a work-around is, when doing a "Save As" of your file, to enter the file name in quotes, i.e.. ".htaccess". You may also be able to change the file name after uploading in your FTP program browser window.