Monday, April 28, 2014

How to manually set Password Protected Directory in cPanel

The system usually requires two files -- the .htaccess file and .htpasswd file.

The .htaccess Code

AuthType Basic
AuthName "restricted area"
AuthUserFile /home/cPanel_username/public_html/protect-me-dir/.htpasswd
require valid-user
The above code protects a directory called "protect-me-dir" at root level. The "AuthUserFile" value is always specific to your hosting configuration. If you don't know what the value should be, do aphpinfo() and find the DOCUMENT_ROOT value.

The .htpasswd Code

davidwalsh:daWHfZrDLB88.
rodstewart:roFulYxC2.8ws
cssexpert:csmnmq.M8T5ho
The .htpasswd file contains the usernames and passwords of allowed users. One per line. The passwords are MD5'd for security purposes.
You will need to create this file in home/cPanel_user/.htpasswds directory
To generate encrypted passwords for your .htpasswd file, you can use the following generator: http://www.htaccesstools.com/htpasswd-generator/

0 comments:

Post a Comment

    Blogger news

    Blogroll

    About