Namecheap domain won't redirect without “www”

落爺英雄遲暮 提交于 2020-02-22 07:16:46

问题


I'm looking to connect my domain to a heroku app. So far, the tutorials I've read say we want Namecheap to have the following records for domain example.com:

CNAME Record    www    www.example.com.herokudns.com
URL Redirect    @      https://www.example.com

With this config, I can successfully get to my homepage using:

  • http://example.com/
  • http://www.example.com/
  • https://www.example.com/

But for some reason http://example.com/ won't connect and times out. Does anyone know if there's a way to get both https://example.com/ and https://www.example.com/ to redirect successfully?


回答1:


You won't be able to do this with DNS provided redirects.

The reason is that at the point of redirect, ie your DNS provider they would need to:

  1. Accept https/443 requests to their redirector
  2. have a valid certificate for hacksofcharity.com

if they don't you'll either receive a timeout, or a certificate mismatch in your browser. When apex domains are involved with https then your only option is to be using a DNS provider that supports using CNAME - see https://devcenter.heroku.com/articles/custom-domains#add-a-custom-root-domain and perform any redirects within your application code base.



来源:https://stackoverflow.com/questions/52581172/namecheap-domain-wont-redirect-without-www

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