gpt4 book ai didi

redirect - 为什么我的 URL 重定向在没有 www 的情况下不起作用?

转载 作者:行者123 更新时间:2023-12-03 21:56:53 27 4
gpt4 key购买 nike

我想要以下重定向:

http://example.com -> http://www.example.com
example.com -> http://www.example.com
www.example.com -> http://www.example.com

在我的 namecheap 中,我设置了两个 URL 重定向记录:
CNAME Record        | www | appname.us-east-2.elasticbeanstalk.com.
URL Redirect Record | @ | http://www.example.com | Unmasked

但是,我仍然只能访问 http://www.example.com当我真正输入这个完整的 URL 时。当我删除 www 时,请求超时。所以 URL 重定向似乎没有做任何事情。如何正确重定向到我的完整 http 域?

最佳答案

You could make www.domain.com the A record and all the other domainnames CNAMEs of www.domain.com. But this only "solves" that if the IP address of www.domain.com changes you don't have to alter the other DNS enties as they are aliases.

So on the DNS level there is no way to enforce a redirect. And for a good reason because DNS is used for more then only HTTP. For example if all request for domain.com would redirect to www.domain.com your email addresses will change to user@www.domain.com.



因此,对于 HTTP 重定向,您必须使用 HTTP 解决方案。这可以在网络服务器级别(nginx、apache 等)

关于redirect - 为什么我的 URL 重定向在没有 www 的情况下不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61492796/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com