The DNS is a tree, inverted if you want.
It starts with the root, aka .
, typically written on top.
Then just below you have TOP level domains, aka TLDs. You can find the list of them at https://www.iana.org/domains/root/db
Do note they change, albeit slowly. There can be changes in countries, but most often they are changes in gTLDs, following ICANN 2012 round of new TLDs and supposedly some future new rounds.
ccTLDs are delegated to government. For your example: https://www.iana.org/domains/root/db/ph.html showing the Philippines owning it.
Each ccTLD (country) decides then how they handle their TLD, if it is flat, or if it is again subdivided. In history, some started subdivided (ex: uk
had co.uk
, me.uk
, etc.) and then opened directly below TLD (you can now register directly under uk
).
So in your example, in precise naming, ph
is the TLD. com.ph
is an 2LD or Second Level Domain.
It may be seen sometimes people will say com.ph
is the TLD because they are thinking about the registration plane, not the resolution plane.
The resolution plane is the DNS and the structure explained above: TLDs are single labels below root, then everything below is "Second Top" level (SLD or 2LD), then third and so on (you can look at us
TLD for examples of names being 4th, 5th or even 6th levels below root).
But, the registry of ph
for example may have decided that you can only buy domains below com.ph
not directly below ph
. That is totally their right. As such some people will consider it is useless to speak about ph
directly, because you can't "do" anything below it, you can only act below com.ph
.
So it happens that TLD will often be used (misused) for labels that are technically not first level below root. Coming from the web, because of cookies, you can find sometimes also "eTLD" for "effective TLD", like "it is not technically a TLD because not one label below root, but act as one in the sense people register domains below it".
But the real proper term should be "public suffix". It means "anything" (TLD or not) that does exist in the public DNS, and is a valid suffix, that is a point (anchor) below which you can register names.
Also remember that registration can happen at multiple levels at the same time. Verisign handles .com
TLD and you can register below it, but then Centralnic bought uk.com
(from Verisign) and Centralnic acts as a registry so you can buy domains under uk.com
"TLD". As such, both com
and uk.com
are valid public suffixes.
But going back to your example in com.ph
, there com
IS NOT a TLD. And any domain never has 2 TLDs, there is only one, technically the first label when starting from the right.
Terminology wise, the WHATWG Community (browsers basically) enacted those terms to be stricter at https://url.spec.whatwg.org/:
- A host’s public suffix is the portion of a host which is included on the Public Suffix List.
- A host’s registrable domain is a domain formed by the most specific public suffix, along with the domain label immediately preceding it,
if any.
See also this RFC on DNS terminology if you want to be sure to exact proper technical terms in all cases: https://www.rfc-editor.org/rfc/rfc8499 but it is mostly dealing with the resolution plane, not the registration one. See its definition of TLD:
Top-Level Domain (TLD): A Top-Level Domain is a zone that is one
layer below the root, such as "com" or "jp". There is nothing
special, from the point of view of the DNS, about TLDs. Most of
them are also delegation-centric zones (defined in Section 7), and
there are significant policy issues around their operation. TLDs
are often divided into sub-groups such as Country Code Top-Level
Domains (ccTLDs), Generic Top-Level Domains (gTLDs), and others;
the division is a matter of policy and beyond the scope of this
document.
You can also view current list of public suffixes at https://publicsuffix.org/ ; do remember this is a manually curated list, which obviously includes all TLDs, but much more because of what we discussed above.
PS: the root servers are not "redirecting" you, there is no concept of "redirection" in DNS world, this was invented 15 years after DNS was invented, when HTTP was created.
You can ask root servers about ph
and they reply it is delegated to:
$ dig +noall +auth ph @a.root-servers.net NS
ph. 2d IN NS ns4.apnic.net.
ph. 2d IN NS ns2.cuhk.edu.hk.
ph. 2d IN NS 1.ns.ph.
ph. 2d IN NS ph.communitydns.net.
You can then ask any of these nameservers about where com.ph
is delegated, if it is (a "dot" in a name does not technically imply always a delegation; for example gouv.fr
right now is not technically delegated out of fr
even if it works perfectly):
$ dig +noall +auth com.ph @ns4.apnic.net. NS
ph. 15m IN SOA ph-tld-ns.dot.ph. sysadmin.domains.ph. (
2023010421 ; serial
21600 ; refresh (6 hours)
3600 ; retry (1 hour)
2592000 ; expire (4 weeks 2 days)
86400 ; minimum (1 day)
)
So by this reply you can see, com.ph
not being technically delegated from ph
, which means it is handled by the same nameservers and hence the same organization (you would get the opposite result if trying with com
and uk.com
because as explained above they are handled by different organizations).