What does WWW do?

10,943

Solution 1

www is a subdomain of example.com.

You can configure DNS to have multiple sub domains which resolve to different web servers and hence give you a different site.

example.com (no subdomain)

site2.example.com

site3.example.com

It sounds like whoever set up the network set example.com to resolve to the internal web server, on the networks DNS server; this is accessible only to hosts on the internal network, so anyone who browses to example.com inside the network sees a different website from those externally, as they use a different DNS server to resolve example.com. It may have been better to give this its own sub domain. e.g internal.example.com

A user inside the network browses to www.example.com hits a link and is taken to example.com which is fine externally, but internally they resolve to different web servers, which is why you have been asked to change the links.

If the content on the internal server is the same as the external, then you could end up with the reverse problem. When browsing the internal site, any hyperlink takes you to the external site.

If possible you might find it better to use relative URLs in your hyperlinks. e.g. <a href="/index.htm">Index Page</a> instead of <a href="https://example.com/index.htm">Index Page</a>

The browser would then choose https://www.example.com or https://example.com depending on the site that you browsed to.

Why the www works could possibly be Wildcard DNS entry, which means *.example.com resolves to the same IP, effectively a catch all for sub domains that don't exist.

Solution 2

WWW is an acornmyn for the World Wide Web, it also happens to be a common subdomain employed by people to designate that the domain is hosting a web site.

The use of a subdomain name is useful for load balancing incoming web traffic by creating a CNAME record that points to a cluster of web servers. Since, currently, only a subdomain can be cname'ed the same result cannot be achieved by using the bare domain root.

In most cases I believe the www. subdomain is omitted and it doesn't really matter if you type the one or the other. However, given what the web looks like today and seeing as how HTTP and the web is really ubiquitous, I would never mandate the inclusion of www. in the domain name and if you look a web sites today you'll notice that sites such as facebook and google prepend www., even if you don't type it.

Why it works even when you type other things has to do the way your DNS is setup for that domain. There are ways to handle wildcards and forward all traffic regardsless of subdomain to the same web server. But it's up to the web server to respond to each individual host header in some manner and this is entierly configurable (and obviously you need to check what the configuration is to answer the question in full).

Solution 3

If they are trying to use exactly this "url": http:\example.com\PAGE.XXX then nothing will help them.

As of www suffixes in www.example.com ...

Historically 'www' as 'ftp', 'pop3', etc. were names of machines running corresponding services inside 'example.com' domain. And actually this schema is still used in many companies.

Share:
10,943

Related videos on Youtube

Wesley Murch
Author by

Wesley Murch

Thanks for your interest.

Updated on November 20, 2022

Comments

  • Wesley Murch
    Wesley Murch over 1 year

    To be clear: I am not asking whether or not I should use www in my url, or what the pros and cons are, that topic is well covered. I also wasn't sure if this was a Stack Overflow, Server Fault, or Webmaster's question - migration to a more appropriate channel is quite welcome.


    Background: I was recently asked to convert a site's urls to all use www, as in http://example.com to http://www.example.com. The reason for the request is over my head. I present an excerpt from the email:

    Got an issue,

    Apparently whenever the site was originally setup with their network (prior to me), the installers chose to use the internal domain as 'example.com' ... not good ...

    This is a problem trying to resolve externally .... I looked at a few qweb page source coding and saw many links are coded as 'http:\example.com\PAGE.XXX' ...

    Can it possibly globally be changed from 'http:\example.com' to 'http:\www.example.com'

    I can resolve www, but once I hit a link it thinks the server is the internal EXAMPLE which houses the domain 'example.com' ...

    Something to do with the client not being able to access the website on their own network. As I mentioned, I don't quite understand it.

    So, I implemented the change, but while testing, I accidentally typed in an extra w, and to my surprise - the site still worked.

    Then I tried several w's, then two, then I typed in some nonsense and the site still worked.

    EDIT: To be more accurate, only alpha, numeric, dash, and underscore characters will resolve, anything else returns a Server not found error in the browser.

    I just tested this on Stack Overflow and got redirected when I used www, while everything else returned a "Server not found" error.

    Does anyone have any insight into what the point of this email request is, and why the accidents and experiments I mentioned worked?

    I can certainly provide more information, I'm just not sure what would be relevant.

    • Admin
      Admin almost 13 years
      Never heard of that before... almost like a "catch-all" for sub-domains where you can literally type anything and still get to the main domain. So what happens when you try test.yourDomain.com? Does it rewrite or redirect to www. or does the test. persist in the URL?
    • Admin
      Admin almost 13 years
      Look in the W3C site.
    • Admin
      Admin almost 13 years
      @Sparky672: It displays normally, no redirect or anything.
    • Admin
      Admin almost 13 years
      @Wesley: Just to reiterate... you can include any gibberish sub-domain imaginable and it just works? Weird. A "Mod Rewrite with wildcards" was my initial thought but if the random sub-domain persists in the URL, I have no idea of the mechanism behind it.
    • Admin
      Admin almost 13 years
      @Sparky672: Looks like alpha numeric dash and underscore are all that's allowed, but otherwise you can type in anything and it will resolve. Non alpha/dash/numeric/underscore returns Server not found in the browser.
    • Admin
      Admin almost 13 years
      +1 for a curiosity and anxious to see an explanation.
    • Admin
      Admin almost 13 years
      It's a DNS wildcard but it's still subject to DNS naming standards which doesn't allow just any character data.
  • Admin
    Admin almost 13 years
    So what explains how the OP can literally type any sub-domain into the URL and it still works?
  • Admin
    Admin almost 13 years
    Given that the web servier is setup in a similar fashion. The web server has to map wildcards as well to the right web site. That is, what ends up in the host header could probably be anything but if it isn't mapped correctly it won't land in the right web site.
  • Admin
    Admin almost 13 years
    It's not making sense to me. He claims that he can literally type any gibberish into the sub-domain and the site still comes up fine with that random sub-domain included in the URL.
  • Admin
    Admin almost 13 years
    Yes, DNS wildcards (I even linked it in the answer), I'm telling you. You can have wildcard subdomains and if your web server does host mapping using wildcards as well that will work. Just as described.
  • Admin
    Admin almost 13 years
    I'm not disputing your explanation. Just making sure we're all on the same page as the OP while also stating that his description is a new one to me.
  • Admin
    Admin almost 13 years
    @JohnLeidegren: This is interesting, I think you may be correct - I will have to check tomorrow and see if that information can even help us solve our problem.
  • Admin
    Admin almost 13 years
    Nice explanation, it's becoming clearer to me now. Good tip about the relative URLs - I'm using them for 90% of the site already, but sometimes they slip under the radar since we're using a CMS for everything. So, technically, one could opt not to allow www to resolve as a subdomain?
  • Admin
    Admin almost 13 years
    Yes, although it is commonly done. With full DNS control I believe you have to explicily set the DNS entry for the www. My DNS provider automatically adds www as a subdomain.