Names and maximum lengths of the parts of a URL

感情迁移 提交于 2019-12-23 06:58:33

问题


In this URL:

http://www.subdomain.domainname.abc.xyz.com.us/directory/filename.extension
  1. What is the name of each part?
  2. What is maximum length of each part? e.g. subdomain, domain name, top-level domain…

回答1:


The Wikipedia entry for Subdomain answers both questions:

  1. What is the name of each part?

A subdomain is a domain that is part of a larger domain; the only domain that is not also a subdomain is the root domain. For example, west.example.com and east.example.com are subdomains of the example.com domain, which in turn is a subdomain of the com top-level domain (TLD). A "subdomain" expresses relative dependence, not absolute dependence: for example, wikipedia.org comprises a subdomain of the org domain, and en.wikipedia.org comprises a subdomain of the domain wikipedia.org.

  1. What is maximum length of each part? e.g. subdomain, domain name, top-level domain…

In theory this subdivision can go down to 127 levels deep, and each DNS label can contain up to 63 characters, as long as the whole domain name does not exceed a total length of 255 characters. But in practice most domain registries limit at 253 characters.




回答2:


To answer question 1:

A simple URI would look something like:

http://www.mywebsite.com

It's easier to explain right to left:

  • com is the top level domain (TLD)
  • mywebsite is the domain, but would typically include the TLD when describing, e.g. mywebsite.com
  • www is a subdomain
  • http:// is the protocol used to access the resource

Just to make things a little more confusing, many top level domains are actually 2 domains, such as .co.uk

So, another example would be:

https://aaa.bbb.ccc.mywebsite.co.uk
  • co.uk is the TLD
  • mywebsite is the domain
  • ccc is a subdomain
  • bbb is a sub-subdomain, or you could say a subdomain of ccc.mywebsite.co.uk
  • aaa is a sub-sub-subdomain, or you could say a subdomain of bbb.ccc.mywebsite.co.uk

Anything after the TLD but before the filename is called the path, e.g:

https://www.mywebsite.com/this/is/a/path/to/resource/filename.txt

In the above example filename.txt is usually called a resource (although some would say the whole line is the resource, because you don't always have a filename).



来源:https://stackoverflow.com/questions/10552665/names-and-maximum-lengths-of-the-parts-of-a-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!