Home > Back-end >  Can a domain consist of only TLD (top level domain)?
Can a domain consist of only TLD (top level domain)?

Time:10-20

I am building a validation function for domains and was wondering.

Can a valid domain consist of only TLD (or one word domain)?

Example - net com exit museum

Is that a valid domain?

CodePudding user response:

Yes. Quick and dirty check:

$ for tld in $(wget -O- -q https://data.iana.org/TLD/tlds-alpha-by-domain.txt); do result=$(dig  short ${tld}. a); if [ -n "$result" ]; then echo "$tld $result"; fi; done

then, for example: http://ai/

  • Related