Articles & Code Snippets


Authentication with .htpasswd On Mac OS X

Authentication with .htpasswd On Mac OS X


Open Terminal and type:
$ htpasswd -c /www/domain.com/.htpasswd yourusername
After running the command it will ask for your password.
Create a .htaccess file at the directory you want to protect, suppose /www/domain.com/.htaccess. With the following lines:
AuthName "Login"
AuthUserFile /www/domain.com/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
< LIMIT GET POST >
require valid-user
< /LIMIT >
Now save .htaccess and try running the page, that's it! web


Archives