Using PointDNS on Heroku to manage SSL and non-www to www redirects

前端 未结 2 1843
遥遥无期
遥遥无期 2021-01-03 05:51

I\'ve been using Heroku to host and manage a website of mine that requires an SSL certificate. For the last year and a half I\'ve been using ZerigoDNS to manage my domain a

相关标签:
2条回答
  • 2021-01-03 06:23

    Regarding non-www to www redirects, I just got that to work as follows:

    First, you must add both www.your-domain.com and your-domain.com as custom domains.

    heroku domains:add andrewpuglionesi.com
    heroku domains:add www.andrewpuglionesi.com
    

    I have a CNAME record with name www.my-domain.com.. The text in its data field is my-heroku-domain.herokuapp.com. I also have an alias record with the name my-domain.com., and I made its data field www.my-domain.com. In other words, the alias just points to the CNAME.

    I don't know if this is well-advised, but it seems to work (and without sticking www in the user's URL, at that). It simply solves the problem where you can't access pages other than the index without having www there). I like how Heroku and PointDNS' documentation both say you can easily do redirects and then don't actually explain how to... I guess this is one way.

    I've previously been able to force https protocol through the backend of a Django site. I can't remember the exact method I used, but you might be able to do it without the DNS stuff.

    0 讨论(0)
  • 2021-01-03 06:48

    First, add both www.your-domain.com and your-domain.com as custom domains under settings or run below commands

    heroku domains:add domainname.com
    heroku domains:add www.domainname.com
    

    For redirection, you need to do it via server, eg. if you are using apache you can achieve redirections via .htacess file.

    Also, you can only redirect non-www to www with pointDNS redirect option

    0 讨论(0)
提交回复
热议问题