完整网址是否有官方名称的子部分?

  • 本文关键字:官方 是否 http url web
  • 更新时间 :
  • 英文 :


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

+-------------------------+-----------+
|         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 的正式名称实际上是一个 URI。

相对 url 的正式名称是 URI 引用。

  • 方案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. 没有权限或主机部分(尽管有主机名(。

引用:

  • 官方RFC:https://www.rfc-editor.org/rfc/rfc3986
  • 我为PHP编写了一个流行的URI解析器:https://packagist.org/packages/sabre/uri

假设我们有以下地址:

https://account.digikala.com:6985/inventory/index.html?q=car&category=9095#top
  • 整个地址名称为URI12

  • 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,如您所见,它由两部分组成,TLDdigikalaSLD.com

  • /inventory/index.htmlPathname

  • ?q=car&category=9095Query,称为SearchParameters&分隔,因此在此URI中,我们有q=carcategory=9095参数

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

最新更新