Why do these URLs without a TLD resolve to a webpage?
Asked Answered
P

2

13

I noticed that the URL ga resolves to a website, but without a TLD like .com, .org, etc. I wrote a script to test all the two-letter URLs:

#!/bin/bash
for a in {a..z}
do
    for b in {a..z}
    do
        curl "$a$b" -s -m 10 >> foo.txt
        if [ -s foo.txt ]
        then
            cp foo.txt "$a$b.txt"
            rm foo.txt
            echo "$a$b"
        fi
    done
done

which prints

ai
dk
pn
to
uz

The script isn't perfect (it doesn't recognize ga, for instance), but it shows that there are several more of these URLs. I did notice that these URLs are all TLDs in their own right-- ai is Anguilla, dk is Denmark, etc. Why are these URLs "valid" in the sense that they resolve to an IP address, and why do they exist?

(I'd make these into clickable links, but funnily enough, the SO formatter won't accept them as valid.)

Plainsong answered 1/10, 2014 at 23:8 Comment(0)
B
15

They don’t have a TLD, they are TLDs.

If you control a top-level domain, you can add DNS resource records for the TLD itself as well as any of its subdomains (which would be second-level domains, or typically called domains), and of the subdomains of the second-level domains (i.e., third-level domains), and so on.

While it’s not so common, some TLD owners make the TLD resolvable (e.g. the to TLD: http://to/ or, if your browser {or Stack Overflow’s editor ;)} has problems with it, as FQDN: http://to./).

Related question on Server Fault: How the heck is http://to./ a valid domain name?

Blunk answered 4/10, 2014 at 0:27 Comment(2)
Interesting, thanks for your answer. As an extension to the question: I'd have assumed that governments would control the TLDs, but it seems like dk is a shopping site. Were they just sold to the highest bidder?Plainsong
@kevinsa5: Governments typically only control ccTLDs. dk. redirects to dk-hostmaster.dk, which is the registry for the dk TLD. However, I guess it would be possible to sell the right to use the TLD to someone else (according to the linked SF question, to. seems to have been used as URL shortener; maybe this service wasn’t provided by the registry/government of Tonga, but I don’t know that).Blunk
Z
1

I think just like a subdomain (i.e. subdomain.domain.com) is not strictly required to make the URL resolvable, the domain itself isn't required either, as it is just a subdomain of a TLD. It's just that actually registering a TLD with an IP directly isn't a common practice.

Zook answered 1/10, 2014 at 23:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.