Write Following code in .htaccess file and save it into the folder which you want to authonticate.
Change the path (In red) and enter the Folder path which you want to authenticate.
AuthName "Somewhere.com's Secret Section"
AuthType Basic require valid-user
To create an .htpasswd file, login to the server via telnet(Command line) go to the directory you specified in AuthUserFile. In the example, this is /mnt/web/guide/somewhere/somepath. Then use the htpasswd program with the -c switch to create your
.htpasswd in the current directory. (as per following)
htpasswd -c .htpasswd username
Adding password for username.
Re-type new password:
To delete users, open the .htpasswd file in a text editor and delete the appropriate lines:
Here is more information
The Apache authentication is used when you need to protect your web content from public access. This is basic security and is only recommended when the information is not so vital because either with Basic or Digest authentication (the two methods Apache supports) in both methods the web content is send to the network without encryption. So if you really need all your data to travel encrypted, use SSL.