vaheeD khoshnouD

linux, mikrotik, macosx

htaccess and htpasswd in Apache server

Written by vaheeD on December 28, 2012
4.00 avg. rating (84% score) - 1 vote


/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

 

4.00 avg. rating (84% score) - 1 vote

Posted Under: Linux, Macosx

About vaheeD

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by WP Anti Spam