将https://example.com重定向到https://www.example.com:Namecheap和Heroku

编程入门 行业动态 更新时间:2024-10-23 22:36:56
本文介绍了将example重定向到www.example:Namecheap和Heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正尝试将所有请求重定向到:

I'm trying to redirect all requests to:

example www.example example

到www.example.我正在使用Heroku和Namecheap.

to www.example. I'm using Heroku and Namecheap.

这是我的步骤:

  • 在Heroku中,我将www.example添加到了我的域中,并启用了SSL.
  • 在Namecheap上,我创建了一个CNAME记录,其中主机www到www.example.herokudns.
  • 在Namecheap上,我用主机@到www.example/创建了URL Redirect记录.
  • In Heroku, I added www.example to my domains, and enabled SSL.
  • On Namecheap, I created a CNAME record with host www to www.example.herokudns.
  • On Namecheap, I created a URL Redirect record with host @ to www.example/.
  • 通过这些步骤,只要我将http请求重定向到服务器端的https请求(例如,将www.example/重定向到www.example/),一切都将正常工作.

    With these steps, everything works well as long as I redirect http requests to https requests on the server side (e.g. redirect www.example/ to www.example/).

    我唯一不知道的事情是如何将example重定向到www.example.根据我的阅读,看来这是ALIAS记录可以完成的工作.不幸的是,Namecheap似乎没有这种类型的记录.

    The only thing I can't figure out is how to redirect example to www.example. From what I've read, it looks like this is what an ALIAS record could accomplish. Unfortunately, Namecheap doesn't seem to have this type of record available.

    是否可以使用Namecheap获得此行为,还是必须使用其他DNS提供程序?

    Is it possible get this behavior using Namecheap, or do I have to use a different DNS provider?

    推荐答案

    对于仍然存在此问题的任何人,我都找到了Namecheap解决方案,用于将根域重定向到子域.

    For anyone that is still having this issue, I found a solution with Namecheap for redirecting the root domain to a subdomain.

  • 我将子域指向了我的网站位置(在这种情况下为Github页面)
  • 我为@ host创建了一个CNAME记录,并将其值作为我的子域
  • 这会将我的根域重定向到我的子域.

    This redirects my root domain to my subdomain.

    更多推荐

    将https://example.com重定向到https://www.example.com:Namecheap和Heroku

    本文发布于:2023-11-01 11:39:20,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1549242.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:重定向   https   www   Heroku   Namecheap

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!