I used a Password Protect Script for some of my pages, but .htaccess files would work best to restrict people from seeing folders.

The script I used for my pages, whenever you refreshed you would have to put password in.