If you’re looking for a simple way to password protect a web server’s public directory then .htaccess is the way to go. Simple yet powerful, .htaccess is really easy to setup. You can even use this tool if you’re really in a hurry.
With .htaccess you can do such thing as setup error pages (not founds, etc), password protect directories and files, block users by IP or by referrer, do redirects or prevent directory listing.
If you want to learn how .htaccess works follow this very good tutorial on the subject.