basic networking question on URLS
Lets say there is a website called www.hello.com
So what really is www - is it the name of the machine? If that is so, hello.com is开发者_JAVA技巧 the domain, which means there can be only 1 machine in hello.com that is called www?
Second and related question is, why is stackoverflow http://stackoverflow.com and not www.stackoverflow.com?
Thanks in advance
It's something that used to be added on everything in the early days of the web and its not standard any more. Whoever owns the url can decide to ignore, accept, or alter incoming urls that do or do not have the www on them. Practically speaking, it's not technically part of the real name of the url, or you could say that it is always part of the url and we sometimes choose to skip it, depending on your point of view. But technically, it's a subdomain, like meta.stackoverflow.com, but I would think it's bad form to make a separate site foo.com and www.foo.com that have different content. Just most sites point both to the same content.
www is a subdomain of hello.com
Commonly the DNS records of both hello.com and www.hello.com are set to point to the same website.
From an SEO perspective they are treated as two different domains so you might find that a www.hello.com redirects to hello.com to help improve search engine ranking. Which might be the justification for http://www.stackoverflow.com redirecting to http://stackoverflow.com
A domain name is just a friendly version of an IP address.
www is just an outdated convention for hello.com's web server
Domain name system formulation taken from Wikipedia:
A domain name consists of one or more parts, technically called labels, that are conventionally concatenated, and delimited by dots, such as example.com.
- The right-most label conveys the top-level domain; for example, the domain name www.example.com belongs to the top-level domain com.
- The hierarchy of domains descends from right to left; each label to the left specifies a subdivision, or subdomain of the domain to the right. For example: the label example specifies a subdomain of the com domain, and www is a sub domain of example.com. This tree of subdivisions may consist of 127 levels.
- Each label may contain up to 63 characters. The full domain name may not exceed a total length of 253 characters.[9] In practice, some domain registries may have shorter limits.
- DNS names may technically consist of any character representable in an octet (RFC 3696). However, the allowed formulation of domain names in the DNS root zone, and most other sub domains, uses a preferred format and character set. The characters allowed in a label are a subset of the ASCII character set, and includes the characters a through z, A through Z, digits 0 through 9, and the hyphen. This rule is known as the LDH rule (letters, digits, hyphen). Domain names are interpreted in case-independent manner. Labels may not start or end with a hyphen.
- A hostname is a domain name that has at least one IP address associated. For example, the domain names www.example.com and example.com are also hostnames, whereas the com domain is not.
http://stackoverflow.com redirects the user to www.stackoverflow.com generally through the use of what is called an A record.
精彩评论