Password protection restricts access to a directory — useful for staging sites, admin areas, or private content.
/home/yourusername/.htpasswd using SSH:htpasswd -c ~/.htpasswd protecteduser
Enter your desired password when prompted.
.htaccess in the directory you want to protect:AuthType Basic
AuthName "Restricted Area"
AuthUserFile /home/yourusername/.htpasswd
Require valid-user
AuthType Basic
AuthName "Restricted"
AuthUserFile /home/yourusername/.htpasswd
Require valid-user
Satisfy Any
Order deny,allow
Deny from all
Allow from 203.0.113.10
This allows your office IP without a password while requiring auth from everywhere else.