网址(例如"a.b.example")与而不是"b.example/a"? [英] What's the difference between a URL such as "a.b.example" instead of "b.example/a"?

查看:85
本文介绍了网址(例如"a.b.example")与而不是"b.example/a"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我看到的某些网站的URL格式为a.b.example,而另一些网站的格式为b.example/a?

例如,为什么用gist.github.com代替github.com/gist?

解决方案

这些是不同的组件.有关组件及其定义的列表,请参见URI标准的第3 节.

 https://gist.github.com/
 

  • 权威(或更具体地说,主机)是gist.github.com.
  • 路径/.

 https://github.com/gist
 

  • 权威(或更具体地说,主机)是github.com.
  • 路径/gist.

由于https://gist.github.com/通常还具有类似第二个URI的路径(例如https://gist.github.com/foobar),所以我想您主要对 authority 组件感兴趣.

在您的示例中,使用了 DNS ,即,这些是(由标签. 分隔)组成:

  • gist第三级域( aka.子域)
  • github二级域名
  • com顶级域(TLD)

顶级控制第二级,第二级控制第三级,依此类推.因此,如果您购买域名github.com,则通常可以控制其所有第三级域(以及第四级等).

使用哪种URI设计取决于网站管理员,并且该决定可以取决于许多不同的因素:它们及其使用的系统在技术上有什么可能,可用性(示例),等.使用不同的主机名(域)的常见原因是它们可以轻松地托管在不同的服务器上.

示例:

  • eBay对每个本地站点使用不同的(顶级)域(例如,对于德国,http://www.ebay.de/,对于意大利,http://www.ebay.it/)
  • Tumblr为每个用户使用一个子域(例如,http://alice.tumblr.com/代表爱丽丝,http://bob.tumblr.com/代表鲍勃)
  • Twitter为他们的每个用户使用路径段(例如,https://twitter.com/alice代表爱丽丝,https://twitter.com/bob代表鲍勃)
  • 维基百科使用不同语言的子域(例如,https://en.wikipedia.org/用于英语,https://fr.wikipedia.org/用于法语)

Why do some websites I see have a URL in the form a.b.example, and others are in the form of b.example/a?

For example, why is it gist.github.com instead of github.com/gist?

解决方案

These are different components. See section 3 of the URI standard for a list of components and their definitions.

https://gist.github.com/

  • The authority (or more specifically, the host) is gist.github.com.
  • The path is /.

https://github.com/gist

  • The authority (or more specifically, the host) is github.com.
  • The path is /gist.

As https://gist.github.com/ would typically also have paths like the second URI (e.g., https://gist.github.com/foobar), I guess you are primarily interested in the authority component.

In your examples, the DNS gets used, i.e., these are domains, which consist of labels, separated by .:

  • gist is a third-level domain (aka. subdomain)
  • github is a second-level domain
  • com is a top-level domain (TLD)

The top level controls the second level, the second level controls the third level, and so on. So if you buy the domain name github.com, you typically have control about all of its third-level domains (and fourth-level, etc.).

It’s up to the webmaster which kind of URI design gets used, and the decision can depend on many different factors: what is technically possible for them and the systems they use, usability (example), SEO (example), etc. A common reason for using different host names (domains) is that they can be easily hosted on different servers.

Examples:

  • eBay uses different (top-level) domains for each of their localized sites (e.g., http://www.ebay.de/ for Germany, http://www.ebay.it/ for Italy)
  • Tumblr uses a subdomain for each of their users (e.g., http://alice.tumblr.com/ for Alice, http://bob.tumblr.com/ for Bob)
  • Twitter uses a path segment for each of their users (e.g., https://twitter.com/alice for Alice, https://twitter.com/bob for Bob)
  • Wikipedia uses subdomains for different languages (e.g., https://en.wikipedia.org/ for English, https://fr.wikipedia.org/ for French)

这篇关于网址(例如"a.b.example")与而不是"b.example/a"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆