24

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…
Ry-
  • 218,210
  • 55
  • 464
  • 476
hamid
  • 341
  • 1
  • 2
  • 5

3 Answers3

34

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.

leek
  • 11,803
  • 8
  • 45
  • 61
commonpike
  • 10,499
  • 4
  • 65
  • 58
11

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).

Rentering.com
  • 399
  • 3
  • 9
YorkshireKev
  • 249
  • 2
  • 9
11

TLDR - The Names

Given foo://example.com:8042/over/there?name=ferret#nose, your components can break down as follows, according to RFC3986 (January 2005)...

     foo://subdomain.example.com:8042/over/there?name=ferret#nose
     \_/  \________/                /\_________/ \_________/ \__/
      |       |                          |            |        |
          \___|_____________________/
   scheme   label       authority       path        query   fragment
   (AKA:                (AKA:
   protocol)            (domain)

TLDR - The Maximum Lengths

  • Label / Subdomain: 63 characters maximum.
  • Domain: 253 characters maximum
  • Total URL: 2,000 characters maximum

The Details

Now, let's break this down for an alternate version of your given URL http://www.subdomain.domainname.com/directory/filename.extension?name=ferret#nose:

Protocol

  • http:// : The scheme, or protocol.
    • Max Length: No limits are imposed, but these are typically created by the IETF, so the longest, RFC'd scheme would be the max, which I see as prospero, 8 characters. However! You can make your own protocol and have it be any reasonable length, though I would probably not exceed 255 characters. For instance, file:/ in Chrome will show the file, samba:/ in Linux will launch the Samba application and access the resource, etc., etc..
    • Source: RFC1738 (December 1994)
    • Quote: "Notes on particular protocols follow. The schemes covered are: ftp, http, gopher, mailto, news, nntp, telnet, wais, file, prospero."

SubDomain

  • www, subdomain : www is just a popular sub-domain that is superfluous today.
    • Max Length: 63 characters
    • Source: RFC1035 (November 1987)
    • Quote: "Labels must be 63 characters or less."

Domain

  • domainname.com : Your "domain," not any level of it but the full domain.
    • Max Length: 253 characters if you care about E-mail (max limit of the to field in SMTP is 255 characters, leaving you with a@(253-char-domain) as the longest possible domain in an email; 255 if you don't mind E-mail not working
    • Source: RFC2821 (October 2008), RFC5321 (October 2008), RFC821 (August 1982)
    • Quote:

The maximum total length of a domain name or number is 255 characters. (RFC2821, RFC5321)

[The email address format is] <mailbox> ::= <local-part> "@" <domain> (RFC821)

Second-Level Domain

  • domainname : Your second-level domain.
    • Same limits and source as subdomains.

Top-Level Domain

  • com : Your top-level domain (TLD). This may also contain a period in it, like co.uk.
    • Max Length: These are established by RFC's by the IETF. The max length will be whatever the longest TLD exists. For instance, RFC6927 reserved the domain .XN--MGBERP4A5D4AR for Saudi Arabia.
    • Source: RFC920 (October 1984)
    • Quote: "The initial top level domain names are: ARPA, GOV, EDU, COM, MIL, ORG."

Path

  • directory/filename.extension : This is your path.
    • Max Length: Infinite, but in practice, please stick to URLs no longer than 2,000 characters, as not all browsers can understand the concept of infinite.
    • Source: RFC3986 (January 2005), RFC2616 (June 1999), RFC7230
    • Quote:

"Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length..." (RFC2616);

"This specification does not limit the scope of what might be a resource..." (RFC3986);

*"It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets." (RFC7230)

Query and Fragment

  • name=ferret : This is a GET parameter, in the form of field=value.
  • #nose : This is the fragment, which can be used to anchor to a specific section of an HTML document using the <a name="nose" /> HTML.
    • Max: As described in the section above on the path, the total path, query, and fragment should not exceed 2,000 characters.
    • Source: RFC3986 (January 2005)
    • Quote:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Community
  • 1
  • 1
HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133