Pejman Moghadam / General

htaccess and htpasswd in Apache server

Public domain


/etc/httpd/conf/httpd.conf

<Directory "/var/www/html">
.
.
AllowOverride All
.
.
</Directory>

/var/www/html/private/.htaccess

AuthUserFile /var/www/html/private/.htpasswd
AuthName "My Private DIR"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>

Add user

Use -c for fist user

# htpasswd -c /var/www/html/private/.htpasswd admin

# chmod 644 /var/www/html/private/.htaccess
# chmod 644 /var/www/html/private/.htpasswd

BY: Pejman Moghadam
TAG: htaccess, htpasswd, apache
DATE: 2009-04-25 00:21:22


Pejman Moghadam / General [ TXT ]