开发者

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

According to RFC 1738: Uniform Resource Locators (URL): 3.1. Common Internet Scheme Syntax, mu开发者_如何学运维st the host component contain a dot, e.g., "example.com"? I.e., may it be composed of only one domain label?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜