Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the allowed characters in a subdomain?

What characters are you allowed to use in a subdomain?

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

I know you can use letters, numbers, and hyphens, but what about other characters? Can _ (underscore) be used?

like image 961
somerandomdude Avatar asked Aug 18 '11 17:08

somerandomdude


People also ask

What characters are allowed in domains?

Keyword: What characters can a domain name contain? A domain name can only contain the letters A-Z, the digits 0-9 and hyphen (-), in addition to one punctuation (.)

What is the maximum length of a subdomain?

A subdomain is a domain that is part of a larger domain. Each label may contain from 1 to 63 octets. The full domain name may not exceed a total length of 253 ASCII characters in its textual representation.

Are underscores allowed in subdomains?

The use of underscore characters is a little confusing. Underscore characters are not permitted in domain names in accordance with RFC 1035, which only allows letters, digits and hyphens. As such, you cannot register a domain name with an underscore character.

Can subdomains have hyphens?

4 Answers. Show activity on this post. Hyphens in subdomains are just as acceptable as hyphens in domain names.


2 Answers

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 https://www.rfc-editor.org/rfc/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 
like image 66
William Dwyer Avatar answered Sep 23 '22 21:09

William Dwyer


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.

like image 39
NightOwl888 Avatar answered Sep 22 '22 21:09

NightOwl888