While surfing; i found many question regarding to SSL certificates error in which Single root domain is working fine with domain.com but throwing error for www.domain.com. I am not satisfied with the answers and though to start new thread in which i can share my experience to help people facing this problem.
SSL certificates are designed to work for exact domains to which it has issued. So, when you buy ssl certificates from CA for www.domain.com; it will work for www.domain.com and may throw error for non www version of the domain.
You can resolve this error using given solutions:
If you will buy wildcard ssl or SAN certificates; it will work completely fine but those certificates are very costly as compare to single root domain and if you are having small website with only single root domain you should not go for such costly certificate. In this case; i recommend buying single root domain for www.domain.com name and do 301 (permanent) redirection of non-www name to www name using htaccess or web.config file depending upon hosting server you are having.
Recently; many SSL authority started providing support for WWW and NON-www domain name. You just need to make sure that; when you buy SSL certificate, you must go for www.domain.com version and it will work for both. Make sure you generate CSR key and private key for www.domain.com version.
Most of Geotrust certificates do the same job properly and their price are also lower as compare to other CA. I did some research for price comparison and found that; it will be beneficial to buy from authorized resellers rather than buying from CA itself as; authorized resellers offers huge discount and here are few products you should check: RapidSSL or GeoTrust QuickSSL Premium certificates.