【问题标题】:Are there official names sub parts of a full url?完整网址是否有官方名称子部分?
【发布时间】:2019-03-06 10:49:18
【问题描述】:

我想澄清一些与网址不同部分的名称相关的术语。 我很确定这些

+-------------------------+-----------+
|         Example         |   Name    |
+-------------------------+-----------+
| foo.com                 | domain    |
| www                     | subdomain |
| http://                 | protocol  |
| 8000                    | port      |
| http://www.foo.com:8000 | url       |
+-------------------------+-----------+

但我不知道这些是否有正式名称:

+---------------------+--------------------+--------------+
|     Description     |      Example       | Name         |
+---------------------+--------------------+--------------+
| no protocol or port | www.foo.com        | hostname?    |
| no port             | http://www.foo.com | url?         |
| no protocol         | www.foo.com:443    | ?            |
| domain no extension | foo                | ?            |
+---------------------+--------------------+--------------+

【问题讨论】:

  • 第一个是“主机名”。
  • 第二个也是“url”。它只是暗示协议的默认端口。
  • 如果端口是8000 而只是没有指定呢?

标签: http url web


【解决方案1】:

完整绝对网址的正式名称实际上是一个 URI。

相对 url 的正式名称是 URI Reference。

  • http 是方案
  • foo.com、user@foo.com 或 foo.com:80 称为 authority。 authority 是 host、port 和 user 的组合。
  • /foo/bar 是 path。
  • ?foo=bar 是 query
  • #foo 是 fragment。

这个粗略的意思是:

https://user@example.org:80/foo/bar?foo=bar#foo
scheme://user@host:port/path?query#fragement
schema://authority/path?query#fragment

据我所知,子域不是一个官方术语。

不同的方案有不同的规则。这也是一个uri:

mailto:foo@example.org

在这种情况下:

  1. mailto: 是 scheme。
  2. foo@example.org 是 path。
  3. 没有权限或主机部分(尽管有主机名)。

参考资料:

【讨论】:

    【解决方案2】:

    假设我们有以下地址:

    https://account.digikala.com:6985/inventory/index.html?q=car&category=9095#top
    
    • 地址全名为URI,1,2

    • https://account.digikala.com:6985/inventory/index.html 是 URL

    • https 部件名称为 Protocol

    • https://account.digikala.com:6985 是 Origin

    • account.digikala.com:6985 是 Host

    • account.digikala.com 是 Hostname

    • account 是 Subdomain

    • digikala.com 是Domain,如您所见,它有两个部分,TLD:digikala 和SLD:.com

    • /inventory/index.html 是 Pathname

    • ?q=car&category=9095 是 Query,称为 Search 和 Parameters 由 & 分隔,所以在这个 URI 我们有 q=car 和 category=9095 参数

    • #top 的最后一部分是Fragment,称为Hash

    【讨论】:

      猜你喜欢
      • 2016-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-16
      • 2018-01-20
      • 2012-08-16
      • 1970-01-01
      相关资源
      最近更新 更多