http-redirecthttpsdnsno-wwwnamecheap

What controls redirection from https://www.host.com to https://host.com?


Everything but https://www.host.com to https://host.com works:

  1. host.com                    --> https://host.com
  2. www.host.com            --> https://host.com
  3. https://host.com          --> https://host.com
  4. https://www.host.com --> ? error

My DNS Records are like this:

  1. Type: A Record
    • Host: @
    • Value: 111.222.333.444
  2. Type: CNAME Record
    • Host: www
    • Value: host.com.
  3. Type: URL Redirect Record - unmasked
  4. Type: URL Redirect Record - unmasked

Along with some MX records. This DNS is on Namecheap so I think URL Redirect Record is a 301 Permanent Redirect.

Also, now after running the URL Redirect Records, nslookup host.com returns two different IP addresses.

What controls that redirection, from https://www to https://non-www?

On Ubuntu 16, DigitalOcean Droplet, with SSL setup via certbot.


Solution

  • Found the error.

    The SSL certificate was missing the www.example.com version/domain.

    Since SSL was installed with Let's Encrypt / Certbot, using sudo certbot certificates showed that Domains: only had the non-www version.

    So redirection was actually working well in all cases except when https caught the www version and threw an error due to missing certificate. Also, redirects 3 and 4 in the original post were unnecessary.