Heroku + Django + Dnsimple - How Do I redirect www request to non-www domain

醉酒当歌 提交于 2020-01-03 16:49:36

问题


Hi i have a django site on Heroku with Dnsimple to manage DNS. I am also using Django to force HTTPS.

I am trying to follow google protocol so that I only have one domain

https://example.com

So that if a user visits http://www.example.com or https://www.example.com it will redirect to https://example.com

My settings in Dnsimple look like this:

ALIAS   example.com     example.com.herokudns.com
CNAME   www.example.com  example.com.herokudns.com

I tried deleting the cname and using the URL redirect in Dnsimple, but it isn't working.

Can someone let me know the correct way to do this redirect? I've tried creating a middleware based on another outdated post, but it crashed my site. Looking for the right way to do this. Thanks

来源:https://stackoverflow.com/questions/49682353/heroku-django-dnsimple-how-do-i-redirect-www-request-to-non-www-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!