HTACCESS. Prevent viewing of folder content on server

Please provide a SAMPLE HTACCESS FILE and INSTRUCTIONS on how to prevent users from viewing server folder content for folders with no index.html file.

Please also provide advice on other better methods to achieve this. Thanks