Main Page / Browse Categories / Howto's & Guides / Htaccess / Password Protection
Password Protection
If you'd like to add password protection there are two ways to accomplish this task 1) Using Plesk's Directory Protection or 2) Using an .htaccess and .htpasswd system. To do the latter, simply follow the tutorial laid out for you below.
 

Note: If you already have a .htaccess file you'd like to use, amend the following to the existing .htaccess file.

Open Notepad (or equivalent software depending on your OS) and paste in the following:

AuthUserFile /home/httpd/vhosts/yoursite.com/httpdocs/folder/to/protect/.htpasswd
AuthGroupFile /dev/null
AuthName "test"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>

yoursite.com = Your Site's Web Address
AuthName "test" <- Can be changed to whatever you want

Note: If you already have a .htpasswd file you'd like to use, amend the following to the existing .htpasswd file.

Open Notepad (or equivalent software depending on your OS) and enter the following:

Username:Password

Note: The password should be encrypted. You can encrypt the password here.

Upload both the htaccess.txt and htpasswd.txt files to the directory you wish to password protect, not the httpdocs folder, in ASCII mode. After uploading, right click the file (server copy) and choose rename. Edit the file name so that they will be .htaccess and .htpasswd (add a . to the beginning and drop the .txt extension)



User Comments
Password Protection
Add Comment
There are no user comments for this topic.
Add Comment
Additional Info
General Information
Article No. 194
Created: 04:34 AM 12.26.03
Author: HPU Support

Attachments
No attachments.

Did this help you?
Yes No

Statistics
Yes600 (49%) Voted Yes630 (51%) Voted NoNo

Other Options
Print Article
Email Article

Related Articles
Understanding htaccess
Custom Errors
Deny/Block Users