webzod
account

Make the www or apex name work over HTTPS

headers.redirect.counterpart_unreachable · effort: about an hour

Why it matters

The other spelling of the domain resolves in DNS but fails over HTTPS, so visitors who type it get an error. Either serve it with a valid certificate and redirect it to the main host, or remove its DNS record.

The fix

  1. Decide whether the other name (www.example.com or example.com) should work. If not, delete its DNS record.
  2. If it should, add it to the certificate, make the web server answer it on port 443, and redirect it to example.com with a 301.
bash
# add the second name to the existing certificate (use --apache for Apache)
sudo certbot --nginx --expand -d example.com -d www.example.com
curl -sI https://www.example.com/ | head -n 1

The examples use example.com. Replace it with your own domain.

Read the documentation (opens in a new tab)

Scan your domain to see whether this applies to you.