Forum Moderators: phranque

Message Too Old, No Replies

How to set password protected directory?

         

toplisek

11:12 am on Feb 15, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have code with two files .htpasswd and as usual .htaccess

.htaccess has the following code:


# Directory Listing
Options +Indexes

AuthUserFile /home/domainname/public_html/.htpasswd
AuthName "Members Only"
AuthType Basic

# Access Restriction:
Require user Admin
order deny,allow



and .htpasswd with values for passwords.


Admin:$password1



How to set correct code within those files to work protected areas on specific folders?
Seems some issue that public_html is all protected not inside this public_html

coopster

1:37 pm on Feb 15, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I highly recommend reading the Apache documentation [httpd.apache.org] on the subject, particularly the How-To / Tutorials in the upper right of the page titled:
Authentication, Authorization, and Access Control [httpd.apache.org]
.htaccess files [httpd.apache.org]
Everything you need is in there, including how to use the htpasswd utility that came with Apache [httpd.apache.org].