大网数据广告活动
网站运营与故障问答

Do CNAME subdomains redirect to their target?

· 52CE 我爱测

I've created the CNAME subdomain: tumblr.wp20201111.blog which maps to doigy.tumblr.com . However, when I load tumblr.wp20201111.blog in the address bar, it doesn't redirect to doigy.tumblr.com , it goes to https://www.tumblr.com…

问题原文

原帖链接 · Steve · CC BY-SA 4.0

I've created the CNAME subdomain: tumblr.wp20201111.blog which maps to doigy.tumblr.com.

However, when I load tumblr.wp20201111.blog in the address bar, it doesn't redirect to doigy.tumblr.com, it goes to https://www.tumblr.com/explore/trending

doigy.tumblr.com is a live URL.

Why doesn't tumblr.wp20201111.blog redirect to doigy.tumblr.com ?

已采纳解答

原帖链接 · davidgo · CC BY-SA 4.0

CNAMEs work entirely differently to his many people think they do, but the problem here also likely involves the web server.

CNAMEs map a (sub)domain to another domain. Because we are talking about web service ultimately this means converting a name to an IP address. What is happening in practice is your computers DNS subsystem looks up tumblr.wp20201111.blog and is referred to doigy.tumblr.com which then provides an A record with an IP address to the OS/browser.

The webserver then connects to the IP address resolved above and says - as part of the http(s) request - I want resources associated with tumblr.wp20201111.blog - (not doigy.tumblr.com). As the webserver likely does not know tumble.wp... it falls back to the defaults in the webserver and gives the final URL. Importantly, the server has no knowledge you want doigy.tumblr.com.

Unfortunately there is no method to do what you want (in the http/https protocol) at the DNS level. The closest you could come would be to configure your own web server to do the desired redirect or act as a reverse proxy.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-11-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。