I looked up couple of questions on SO, which seem to suggest that two continuous hyphens (e.g. my--website.com) are not allowed but when I search for same domain name on http://www.register.com/index.rcmx, it gladly accepts the name while rejects non valid domain names like my#website.com.
Validation for URL/Domain using Regex? (Rails)
4 Answers
It's legal in a domain name, and required for internationalised domain names (IDNs) which when converted from Unicode to ASCII end up prefixed with xn--
-
1This has rules which would allow double dashes: faqs.org/rfcs/rfc1035.html Commented May 9, 2013 at 18:21
-
2RFC1035 is not the last word on legal domain names and host names - there's more in RFC 2181.– AlnitakCommented May 9, 2013 at 18:25
In general double hyphens are allowed. However, in your specific example, it should not be possible, because they may not occur on the third and fourth position except when writing IDN labels in their xn-- notation. See the following section from RFC 5891:
4.2.3.1. Hyphen Restrictions
The Unicode string MUST NOT contain "--" (two consecutive hyphens) in the third and fourth character positions and MUST NOT start or end with a "-" (hyphen).
-
-
-
And only for INTERNATIONALIZED DNS, e.g. xn--j1ail.xn--p1ai which is the ASCII version of кто.рф Commented Oct 5, 2020 at 22:01
-
Double hyphens in the 3rd and 4th positions are not permitted in an Internationalized Domain Name (IDN) per RFC5891, but an IDN is not a "real" domain name in the sense of RFC1034/1035 and DNS, but rather a string that must be converted to an encoded form before usage in DNS. Thus, a registrar must not allow the entry of кт--о.рф because the presence of Unicode characters indicates an IDN string, and the position (3,4) hyphens violates RFC5891; however, DNS clients must allow xx--xxxx.com as a domain as permitted by RFC1034.– ozmoCommented Dec 5 at 23:32
Some TLDs allow as many consecutive dashes as you want, others seem to have specific rules about their positioning.
This is a working website: l-------------------------------------------------------------l.tk (mirror)
The universal rules are:
- Not in the 3rd and 4th position, except as part of an IDN
- Not at the beginning or end
Nothing else can be counted on unless you thoroughly test each individual TLD.
It must be "allowed", regardless of the answers here, because https://hp--community.force.com exists. However, perhaps that's only okay because it's a subdomain of a registered domain, and not a registered domain in itself.
-
2I'm quite sure the rules for subdomains are different - and less restrictive - than the ones for domain names. Commented Jan 9, 2020 at 8:26