Fix SSL Certificate Mismatch
SSL certificate mismatch: the name mismatch
The browser shows ERR_CERT_COMMON_NAME_INVALID, "Your connection is not private" or a "doesn't match" message. The certificate is valid but not for this hostname.
See which names the certificate covers:
openssl s_client -connect example.com:443 -servername example.com < /dev/null 2>/dev/null | openssl x509 -noout -ext subjectAltName
Or run the SSL Checker. Compare the names listed with the one you visit.
| You visit | Certificate covers | Result |
|---|---|---|
| www.example.com | example.com only | Mismatch |
| example.com | www.example.com only | Mismatch |
| shop.example.com | example.com, www.example.com | Mismatch |
| shop.example.com | *.example.com | Match, wildcard covers one level |
| a.b.example.com | *.example.com | Mismatch, wildcard covers one level only |
Common causes
- The certificate was issued without the
wwwname or a subdomain. - The server returns a default certificate because the virtual host for this name has no certificate or no SNI match.
- A CDN or shared host serves another customer's certificate.
- DNS points to the wrong server.
Fixes
- Reissue the certificate with every name you use. You can do this free on TryFreeSSL.com.
- Make sure the right
server_nameorServerNameis in the matching HTTPS virtual host. - Verify DNS with the DNS Lookup.
SSL certificate mismatch: key and certificate
The server will not start or reload and logs something like "key values mismatch". Compare the public keys:
openssl x509 -in certificate.crt -noout -pubkey | openssl sha256
openssl pkey -in private.key -pubout | openssl sha256
If the two hashes differ, the files are from different key pairs. Typical reasons are a renewal that created a new key while the old key stayed in place, or files copied from two different folders. Install the key that was generated with the CSR for this certificate, or reissue with a new CSR and keep that key. More in the guide Check If a Certificate Matches Its Private Key.
Check your redirect and canonical host
Choose one canonical host and redirect the other to it. Both hostnames still need to be covered by the certificate, otherwise the redirect itself triggers the warning first. Test with the HTTPS Redirect tool.
Quick decision guide
| Symptom | Do this |
|---|---|
| Browser warns, server runs | Check names in the certificate |
| Server will not start | Compare certificate and key |
| Warning only on one subdomain | Add it to the certificate or use a wildcard |
| Wrong site's certificate appears | Fix the virtual host or SNI configuration |
Related problems
An incomplete chain gives a different error, see the chain checker guide. If the padlock is still missing after the fix, read why a site says Not Secure after installing SSL.
Related reading: Fix 'SSL Certificate Not Trusted', installation failed errors and the wildcard certificate.
Frequently Asked Questions
Does a wildcard cover the bare domain?
Not on its own. List example.com as well as *.example.com in the request.
Can I ignore the warning?
Do not train visitors to click through it. Fix the certificate.
Why do I see it only on some networks?
Some networks intercept traffic or resolve to a different server. Compare the certificate from two networks.
Is the Common Name still used?
Modern browsers check the Subject Alternative Name list, so make sure the names are there.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.