Reputation: 24099
If my server is set up to redirect users who type the non www URL, e.g.
example.com -> www.example.com.
Do I need to get a certificate for both domains:
example.com, www.example.com
Upvotes: 3
Views: 3577
Reputation: 5819
Yes. If a user types in https://example.com, the TLS handshake between their browser and your server happens before the redirect. Users will see an error message in their browser indicating the site's certificate is invalid.
If you're using Let's Encrypt you can include both www and non-www domains in the same certificate. Most other certificate vendors also do this on request.
Upvotes: 4