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

When you forward a domain permanently via DNS does it keep the underlying URL?

· 52CE 我爱测

I have dealt with using rewrites and rules to forward things in Apache or IIS. I am wondering if I have our current domain name test123.example forwarded to test678.example what will happen if someone is going to test123.example/…

问题原文

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

I have dealt with using rewrites and rules to forward things in Apache or IIS. I am wondering if I have our current domain name test123.example forwarded to test678.example what will happen if someone is going to test123.example/home/products/industrial/product123?

Will it keep the underlying URL behind the domain name while being forwarded? Is there anything that I should think about this before deciding? And this is SSL site using certificate.

已采纳解答

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

This is a really old question that has resurfaced, but none of the answers seem to answer the OP's question. The OP question is about DNS (see the tags), not about redirecting. So,let me try to explain/answer the OP's question for the benefit of newer users.

When a browser needs to communicate with a webserver, it passes the host/domain name to the OSI stack to resolve the name only. It doesn't pass any information besides the host.domainname.tld. I.e., it doesn't pass anything about the home/products/industrial/product123 portion of the request.

The host information gets passed to a name resolution service that uses a combination of hosts files, cache, DNS and possibly other vendor specific services to resolve the name to an IP address.

Once resolved, the IP address of the host.domainname.tld is passed back to the client machine. The client machine then sends the URL along to a TCP service that makes a connection to the destination IP address without regard to home/products/industrial/product123. The destination server passes the Fully Qualified Domain Name (host.domainname.tld) request up the OSI stack to the web service for processing.

The web service, then matches the host.domainname.tld to the hosted website.

Finally, the web service, connects with the file service to match the home/products/industrial/product123 portion of the user's request to the server's content/page and returns the result back to the client browser.

Long explanation, but here's the point. The only two pieces of software involved in locating the file in the URL (not the domain) are the client browser and the web server's web software.

As a result, changing the DNS records only changes the IP address that is resolved for the host.domainname.tld and has no effect on the file location.

That being said, if the file/web structure test123.example.com is different from test678.example.com, simply changing the DNS records will only send the user to the correct server, but not necessarily the correct file/page.

I'm guessing some of the protocols/OSI stacks are different between servers and have changed over the years, so feel free to add corrections as needed.

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

资料来源与适用范围

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

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

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