What are the allowed characters in a subdomain?

前端 未结 4 1626
花落未央
花落未央 2020-11-28 11:02

What characters are you allowed to use in a subdomain?

Example: for someSub.example.com the someSub portion.

I know you can use le

相关标签:
4条回答
  • 2020-11-28 11:17

    Letters (except stressed à), Numbers 0-9 and Hyphen.

    http://en.wikipedia.org/wiki/Domain_name excerpt: Valid characters that can be used in a domain name are:

    a-z
    0-9
    - but not as a starting or ending character
    . as a separator for the textual portions of a domain name
    

    From http://tools.ietf.org/html/rfc1035

    Various objects and parameters in the DNS have size limits. They are listed below. Some could be easily changed, others are more fundamental.

    labels          63 octets or less
    names           255 octets or less
    TTL             positive values of a signed 32 bit number.
    UDP messages    512 octets or less
    
    0 讨论(0)
  • 2020-11-28 11:20

    Technically William is right, and only letters, numbers and hyphen (-) are allowed in subdomains.

    However: in practice, you will see that underscore (_) will also work in all major browsers, but this is not guaranteed. Some providers and other services may not allow you to set it in DNS.

    If you set a wildcard in DNS it will resolve, then then it is up to the actual application to take it or ignore it.

    0 讨论(0)
  • 2020-11-28 11:25

    Ironically, the other answers to this questions are correct answers to the question "what are the legal characters for a hostname or primary domain", while the answers to the question "can (hostname) subdomains have an underscore" are correct answers to this question.

    0 讨论(0)
  • 2020-11-28 11:34

    According to this page, some top level domains now allow localized characters (not just a-z).

    --------------------------------------------------------------------------------
    | Top Level Domain |                    Allowed Characters                     |
    --------------------------------------------------------------------------------
    | .no              | áàäčçđéèêŋńñóòôöšŧüžæøå                                   |
    | .se              | àáäåæçèéêëìíîïðñòóôöøùúüýþćčđěłńŋřśšţŧźžǎǐǒǔǥǧǩǯəʒ, plus Hebrew
    | .dk              | äåæéöøü
    | .is              | áéýúíóþæöð
    | .it              | àâäèéêëìîïòôöùûüæœçÿ
    | .fr              | àáâãäåæçèéêëìíîïñòóôõöùúûüýÿœ
    | .nu              | àáâäåāæçèéêëēìíîïīðñŋòóôõöøōùúûüūýþÿ
    | .be              | àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿœ
    | .de              | àáâãäåāăąæçćĉċčďđèéêëēĕėęěŋðĝğġģĥħìíîïĩīĭįıĵķĸĺļľł
    |                  | ñńņňòóôõöøōŏőœŕŗřśŝşšţťŧþùúûüũūŭůűųŵýÿŷźżž
    | .as              | Same as .de
    | .com             | Same as .de, plus Greek, Cyrillic, Chinese, Korean, etc.
    | .net             | Same as .de, plus Greek, Cyrillic, Chinese, Korean, etc.
    | .org             | áäåāąæćčéēėęģíīįķļłñńņðóöøōőŗśšúüūűųýźżžþ plus Cyrillic and Korean
    | .info            | áäåāąæćčéēėęģíīįķļłńņðóöøōőŗśšúüūűųýźżžþ plus Korean
    | .biz             | àáäåæéêíðñòóôöøúüýþ
    --------------------------------------------------------------------------------
    

    So, looks like we need to go back to the drawing board on that regex.

    0 讨论(0)
提交回复
热议问题