URL rewrite to force 'www' and '.html'

For SEO, I need to force the URL to contain ‘www’ so my app always appears in the browser as www.example.com and not ‘example.com’. I also need the filename (ex. index.html) to appear completely, and not be hidden.

Can someone give us some pointers on how to set this up? I understand the first case involves .htaccess but I’m nervous about modifying that without good guidance.