Search code examples
urlhostrfc

RFC 1738: URL: Must the host contain a dot?


According to RFC 1738: Uniform Resource Locators (URL): 3.1. Common Internet Scheme Syntax, must the host component contain a dot, e.g., "example.com"? I.e., may it be composed of only one domain label?


Solution

  • No, the host doesn't have to contain a dot. I.e., yes, only one domain label is fine. Look at domain, subdomain and label ( https://www.rfc-editor.org/rfc/rfc1034#section-3.5 ):

    <domain> ::= <subdomain> | " "
    
    <subdomain> ::= <label> | <subdomain> "." <label>
    
    <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
    
    <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
    
    <let-dig-hyp> ::= <let-dig> | "-"
    
    <let-dig> ::= <letter> | <digit>
    
    <letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
    
    <digit> ::= any one of the ten digits 0 through 9
    

    This document is referenced from https://www.rfc-editor.org/rfc/rfc1738#section-3.1 to describe the host naming rules.