【问题标题】: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.comuser@foo.comfoo.com:80 称为 authorityauthorityhostportuser 的组合。
  • /foo/barpath
  • ?foo=barquery
  • #foofragment

这个粗略的意思是:

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.orgpath
  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.htmlURL

    • https 部件名称为 Protocol

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

    • account.digikala.com:6985Host

    • account.digikala.comHostname

    • accountSubdomain

    • digikala.comDomain,如您所见,它有两个部分,TLD:digikalaSLD:.com

    • /inventory/index.htmlPathname

    • ?q=car&category=9095Query,称为 SearchParameters& 分隔,所以在这个 URI 我们有 q=carcategory=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
      相关资源
      最近更新 更多