Usually the easiest way to accomplish this is with hidden .htaccess/.htpasswd files at the root of the directory you want to protect. This instructs the web server to require authentication to access.
There are many tutorials out there on how to do this; here is one I found that looks pretty good:
And if the files are hidden on Mac, how do I find them?
Thanks, Jonathan! Do you know how to make an .htaccess and .htpassword file on a Mac? When I try to save the file with the leading period/dot, I get a warning that this is reserved for system files and the file will be invisible. Is it possible to make these files in Whisk and not get the error?
You can show/hide hidden files on the Mac in the Finder or Open/Save dialogs by pressing Command-Shift-Period. Personally though I tend to just view them them via
ls -a in the terminal.
I don't think there's a way to avoid the error, but you should be able to choose the Use "." button to override it to save with a leading dot.