The host name is, in fact, a convenience for your users to remember the name. From this point of view, it is mainly a marketing solution. If you advertised example.com , use this; if you advertised www.example.com , use this.
Back-end redirects, as you seem to suggest, don't sound like a good idea. The certificate point allows the user to verify the identity of your server. If you have only example.com , and if they try www.example.com via HTTPS, they will first receive an invalid certificate warning (so they should not follow the redirect).
You can get both. Some CAs issue SAN certificates for example.com and www.example.com (sometimes at the same price or a little more, I think).
source share