htaccess and htpasswd in Apache server
Written by vaheeD on December 28, 2012
/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