Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
610 views
in Technique[技术] by (71.8m points)

web - What variations of WWW part from the URL's host name exist?

Most URLs on the web can begin with the www. part:

http://www.example.com

or without it:

http://example.com

But I remember I came across seeing something like this:

http://www2.example.com

I need to know what types of the www part of the URL exist besides the ones that I listed above?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are talking about the third-level domain, typically called subdomain. In DNS speak it’s a label.

Such a DNS label can contain up to 63 characters, consisting of

  • a-z
  • A-Z (however, they are interpreted case-insensitive)
  • 0-9
  • -

(Internationalized domain name would allow for more characters, but technically the same character set is used, see Punycode.)

Using www is a very common convention, but in no way required.

A popular example with a different subdomain is Wikipedia. The English Wikipedia has the hostname en.wikipedia.org, i.e., they use en (in their case representing the language code for English) instead of www.

Because www is so common and many people add it to all URLs when typing them, websites typically adapt to it: either by providing both variants (with and without www), or by redirecting from one variant to the other. (The latter is usually preferred because having canonical URLs is useful for many reasons.)

Note that domains don’t have to stop at the third level, you can have more levels, like fifth.fourth.third.example.com. Some sites even use the www convention for such domains, so they’d add www to any domain, e.g. www.fifth.fourth.third.example.com.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...