Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is it called when a website has another word in place of where www usually goes? For example, vs I know the latter is a file on the server that the browser downloads, but what exactly is the purpose of the former? It would be helpful to know what this is called.

share|improve this question
2 is a sub-directory and not a file – Alok Aug 19 '13 at 22:17
up vote 16 down vote accepted

This is is called a subdomain.

Subdomains can be routed via the cname entry to a different server so that when the user types in, the nameserver for is examined, which reveals the IP address for the foo subdomain.

share|improve this answer
Perfect, thank you so much! I can find more information by myself now. It was hard to describe in a Google query without knowing the name haha. I'll mark you as the right answer as soon as it lets me. – Carpetfizz Aug 19 '13 at 15:18
foo is a host. bar is a subdomain. (com is also technically speaking a subdomain of the root domain ..) – Jörg W Mittag Aug 19 '13 at 16:08
@Carpetfizz - For what it's worth, www is also a subdomain, just one that's by convention used for the main webserver. – Bobson Aug 19 '13 at 16:11

Back before the world wide web was invented, servers used the convention of using different host names to access different services. So, for example, if "Example Corporation" had a public server, it was named "". If they provided public ftp access, it would be accessible through the hostname "". The "ftp" part identified an actual server machine on the subdomain "".

Likewise, if "" provided a public smtp server, it would be "". If they provided a gopher server, it would be "". When web servers were invented, pretty much everyone stuck to this convention and named their websites with "www" (eg:

This is simply a convention. Once websites started to proliferate, sites started using their corporate hostname as the main website to make it easier for people to get to the website, so instead of "", the simpler "" would be routed to the web server. As traffic increased, they could have multiple servers, with a load balancer sitting between "" and the various servers that power it.

share|improve this answer

This is usuall accomplished by a url redirect. No page is ever downloaded. Your browser requests the /images resource from the web server (sitting at The webserver responds saying "this is not the resource you're looking for" and points your browser to (like the Bugs Bunny cartoon where Elmer Fudd asks "the park ranger" which way the wascally wabbit went and "the park ranger" says he went thataway).

Your browser then goes to and says gimme what you got (or "get /"). The server responds with the appropriate resource.

share|improve this answer
I like this answer for the fact you used Bugs Bunny and Elmer Fudd to to explain redirections and browser requests! ;) – Keldon Alleyne Aug 19 '13 at 15:30
Haha this cleared it up as well, thanks! – Carpetfizz Aug 19 '13 at 15:40
I try not to take myself too seriously :) – Michael Brown Aug 19 '13 at 17:40

As Keldon said, subdomain is the term you are looking for.

The purpose is generally/originally was to allow someone to control their own mappings of the names to various IP addresses / servers by providing a domain name server themselves rather than registering a bunch of separate domains.

These days there are a fair number of people that use subdomains on the same IP address to do things with cookie/script scope, or to allow their networking hardware to decide where to route the traffic.

For example, resources embedded withing my pages like photos might be referred to at a subdomain like and in my load balancer I could route those through a cache appliance even though they live on the main domain. This lowers the load on my actual web server and speeds up page loads to the clients without be having to do separate deploys and maintain separate actual servers.

I can also use it as it was originally used and assign a separate subdomain to a separate IP address on a separate server to then put different rules and settings on that server to increase security while isolating that overhead from the general marketing site at the main domain.

share|improve this answer
Good point. To add to your network routing rules, I believe that IE also has the ability to say certain sites are whitelisted, but not certain paths on a site. – user40980 Aug 19 '13 at 15:35
Thank you for your answer! – Carpetfizz Aug 19 '13 at 15:39
Most browsers can do that with certificate scopes and such... There are a lot of reasons that you can do this, these are just the ones that happen the most and are explainable. Tokenized subdomains or CDN internals with shortest response DNS are another good use here, but explaining the how of that gets confusing to many people in my experience. – Bill Aug 19 '13 at 15:43

The host name www is a host name. It makes it convenient for people to know where to go for a given service, and as a convention, just entering the domain name (for example google) in many browsers, the browser will go to

However, this points to a host (load balanced it may be), but it points to one server (-ish, yes, there's dns round robin too). This can cause significant traffic to one server, which can be a bad thing.

It is a standard approach to split the dynamic content and static content into two parts and host the static content on a CDN (Content Delivery Network). This requires pointing dns to a different server. As such, the host name for the dynamic content cannot be the same as the static content.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.