How to do SSL redirect?

My default subdomain is I recently changed my custom domain from to I’ve been trying to set up a redirect from the old domain to the new one, and have added a domain alias for, as well as set up a CNAME record blog -> with my DNS provider. However, I keep getting a SSL certificate error when accessing

Here’s a cURL output:

curl -v -L
* Connected to (x.x.x.x) port 80 (#0)

< HTTP/1.1 301 Moved Permanently
< Cache-Control: public, max-age=0, must-revalidate
< Location:
* Connected to (x.x.x.x) port 443 (#1)
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=ca; L=San Francisco; O=Netlify, Inc; CN=*
*  start date: Jun 15 00:00:00 2020 GMT
*  expire date: Aug  3 12:00:00 2021 GMT
*  subjectAltName does not match
* SSL: no alternative certificate subject name matches target host name ''
* Closing connection 1

Heya, @asarkar! Cheers for posting over here at Netlify Community :wink:!

Did you consider setting up a domain alias? In the UI, you can add the second domain and it’ll direct traffic to your primary domain automagically!

I’ve already set up a domain alias, and refreshed the certificate to pick up both domains. However, it doesn’t redirect, just present the site at the old domain. I’ve now deleted the domain alias, and set up a URL redirect with my DNS provider; waiting to see if that works.


If that doesn’t work, you can add the site as a domain alias. Although I said this will happen automagically, you will need to create a small redirect rule:

1 Like

I’ve seen the redirect options too, but they are path based, not for the whole domain.* 301!

That’d redirect everything from the first URL to the second URL :smiley:

1 Like

The Domain-level redirects don’t do the redirect

force = true finally did it along with How to do SSL redirect?

1 Like