Knowledgebase: Web Hosting Related
How do you password protect a directory on your linux server
Posted by Support, Last modified by Support on 04 December 2013 04:33 PM

To password protect a directory. Create or edit the file called .htaccess and enter into the file the following:

AuthName "Protected Area"
AuthType Basic
AuthUserFile /var/www/vhtdocs/userwebXXXXX/html/.htpasswd
Require valid-user

In this example replace the XXXXX with the numbers from your FTP account, this file will protect the html folder if you upload this .htaccess file into the /html folder. You must also have a .htpasswd file in the /html folder as well. The .htpasswd file holds the user names and password of users that will be allowed access to the folder.

You can create the .htpasswd file using the following URL:

(1 vote(s))
Not helpful