Example:
Add auth in directory /home/pank/public_html/auth
User pank, password 1111
- Create .htaccess (in /home/pank/public_html/auth)
AuthName "Simple Auth"
AuthType Basic
AuthUserFile "/home/pank/public_html/auth/.htpasswd"
require valid-user
- Create .htpasswd
htpasswd -cb .htpasswd pank 1111
(-c for Create a new file, -b for Use the password from the command line rather than prompting for it)
htpasswd -b .htpasswd test 2222
- Edit httpd.conf
<Directory "/home/pank/public_html/auth">
AllowOverride All
</Directory>
- Restart Apache
Leave a comment