我想澄清一些与网址不同部分的名称相关的术语。 我很确定这些
+-------------------------+-----------+
| 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.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
在这种情况下:
mailto:
是scheme
.foo@example.org
是path
.- 没有权限或主机部分(尽管有主机名(。
引用:
- 官方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
整个地址名称为
URI
,1,2https://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