HTTPS redirect from root domain (i.e. apex or 'naked') to 'www' subdomain without browser throwing up?

后端 未结 3 1290
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 22:09

DNS A-records require that an IP address be hard-coded into your application’s DNS configuration

...which Heroku recommends avoiding. Heroku

3条回答
  •  故里飘歌
    2021-01-29 22:43

    NOTE: I have not tried this with Heroku app. I am still sharing this solution here as this is the first stackoverflow page that shows up for 'redirection from naked domain to www version' search. It may help others who are looking for an answer to generic redirection.

    I have successfully redirected naked domain to www version. In addition, I also redirected the HTTP version to HTTPS version using google domains DNS settings in synthetic records.

    1. Delete any 'A' records for '@' in your DNS.
    2. Add a synthetic record with subdomain = '@' and redirect it to www version of your website.
    3. After addition, edit this same record and change the default 'http://www.example.com' to 'https://www.example.com' . Note the 's' in http here. Click Save.
    4. That's it. Your redirection is now taken care of by DNS settings.

    Detail steps are documented here: https://www.am22tech.com/redirect-naked-domain-www-http-https-google-domains/

提交回复
热议问题