PDA

View Full Version : Difference b/w http://www.something and http://something ?


abduraooft
08-22-2007, 04:48 PM
Hello,
Just a basic question..

How they differ in opening a particular page?

Edit: I can't open some websites with this www, like http://google.com , It's automatically converting to a www format. And it's making a lot of confusions when working with google's web-master tool.


regards,
art

harbingerOTV
08-22-2007, 04:52 PM
Has to to with the configuration of the server from my understanding.

they are essentially the same, but some servers HAVE to have the WWW some don't care.

srule_
08-22-2007, 05:00 PM
some can't have www. WHen i make subdomains it need to be http://mysite.mydomain.com. good question tho, i never really thought of it so i don't know the answer :)

oracleguy
08-22-2007, 05:26 PM
It has do with how the site is setup DNS wise. Technically speaking a proper configuration should let you get to site with or without the 'www' since technically all it is a subdomain.

abduraooft
08-22-2007, 05:31 PM
Thank you all for these quick replies.
But I'm still expecting some detailed explanation about this since I can't make a good query on google regarding this.
good question tho, i never really thought of it so i don't know the answer :)
Hmm.. I got the reason why the "Thank User ..." button comes along with the original post.;)

oracleguy
08-22-2007, 06:24 PM
I basically briefly covered the gist of it.

The only different between http://domain and http://www.domain is that the latter points to a sub-domain of 'www'. And like I said a proper DNS configuration for the site would allow you to use either to get to the main site.

As for the historical origins of prefixing the domain with 'www' was probably so you could point to the web server of a given domain back when the world wide web was new since www.domain and foo.domain can point to physically different servers (or even just domain to get technical).

Turns out that I'm right about that part: http://en.wikipedia.org/wiki/Www#WWW_prefix_in_Web_addresses

CFMaBiSmAd
08-22-2007, 07:42 PM
Having DNS records for www.domain.com and domain.com will cause both of those url's to point to your web site. However, once someone is on your site, you need to be consistent in any links or navigation menus. Always, use one form or the other (using the www. form is recommended.)

The web sites that seem to convert domain.com to www.domain.com are actually redirecting any requests made to domain.com/anything... to the corresponding www.domain.com/anything... address.

Technically, you and everyone else should always use a fully qualified domain name (FQDN) - http://en.wikipedia.org/wiki/FQDN. Leaving off the host name/subdomain name is just a lazy way short cut that causes problems. For example, consider the current CodingForums web page you are viewing. Go up to your browser's address field and remove the www. if it is present or add it if it is not present and refresh the page. You will find that you "appear" to be logged out, because the "logged in" cookie is specific to the url that you logged in under. This could be "fixed" by making the cookie match any subdomain and it could also be fixed by redirecting requests made to the non-www. form of the address to the the www. form of the address.

Edit: The key word in the wiki definition I linked to is unambiguous. If you are not consistently using a FQDN in web site coding you are writing, you are creating ambiguous address references, that things like search engines will have a problem with.

srule_
08-22-2007, 09:43 PM
Thanks for the info guys! much appreciate you saving me a trip to google. lol :thumbsup:

abduraooft
08-23-2007, 04:23 PM
Having DNS records for www.domain.com and domain.com will cause both of those url's to point to your web site. However, once someone is on your site, you need to be consistent in any links or navigation menus. Always, use one form or the other (using the www. form is recommended.)

Sorry,I couldn't understand completely. Are you saying that to link from say index.php to about.php, we have to use
<a href="www.mysite.com/about.php">About</a> instead of just
<a href="about.php">About</a>
?

The web sites that seem to convert domain.com to www.domain.com are actually redirecting any requests made to domain.com/anything... to the corresponding www.domain.com/anything... address.

Edit: The key word in the wiki definition I linked to is unambiguous. If you are not consistently using a FQDN in web site coding you are writing, you are creating ambiguous address references, that things like search engines will have a problem with.
If we search for google (http://www.google.co.in/search?q=wikipedia&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a) and wikipedia (http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&hs=nIt&q=wikipedia&btnG=Search&meta=) in google, google's results come with a www prefix but not for the other one(the same for one website managed by me). My question is anything to worry about this and if yes how can I make it correct.

regards,
art

Spookster
08-23-2007, 05:02 PM
For linking pages together in your site you should always use relative references. <a href="links.php>" verses absolute references <a href="http://www.domain.com/links.php">. If you ever have to change your domain name for whatever reason you don't want to have to change all the links throughout the site.

CFMaBiSmAd
08-23-2007, 05:09 PM
The question of links like -
<a href="http://www.mysite.com/about.php">About</a>
... verses ...
<a href="about.php">About</a>is different and separate from the original question of www.mysite.com and mysite.com. This latest question concerns absolute url's vs relative url's. (Technically, you should only use absolute url's because some older browsers don't support relative url's - just in case anyone on the planet is still living in the late 1990's.)

When you click on a link in a browser, the browser must form a full url to request over the Internet. When the browser finds the first form, an absolute url, it just requests that address. However, when the browser gets a relative url (about.php, ./about.php, ../about.php, /about.php...) it must form a full url by using the url of the current page and the appropriate portion of the relative url in the link.

sage45
08-23-2007, 06:14 PM
First, in the wonderful world of DNS, you are allowed to do certain things no matter how idiotic they may seem/appear. For example, ALIAS's (those darn things can drive you bannana's if they are used inappropriately or misconfigured). But in all seriousness, most people who deal with their own domains and use a total DNS control panel are going to be able to modify (in most cases) three records. A/HOST records, CNAME/Alias records and MX records. A records are considered root level records that both CNAME and MX records reference for data.

So lets walk through this:
www.somesite.com (CNAME/Alias) is a sub-domain of .somesite.com (A/HOST)
In general, most domains follow this common configuration. So how does this work?
This works because at the root level of DNS somesite.com a host records points to an IP address..somesite.com <--> 192.168.1.198 A
Now the .somesite.com Domain Recordset also contains a/an CNAME/Alias record for www that points to the root of the domain.www <--> . CNAMENow you may be asking, whats with this '.' stuff. Well the '.' (just like in the FSO [File System Object]) represents 'root'.

Now knowing this, when a request comes through for www.somesite.com (at the DNS level). The DNS server will respond with 192.168.1.198, because www points to the root of somesite.com which in turn points to 192.168.1.198. Now, as it has been pointed out earlier. When the request to 192.168.1.198 comes through, the web server (not DNS server) looks at the header information to determine which website to reply with (if any). Your web server (after opening the header information) compares the requested host information with the host header value of all of the websites that it hosts. If it finds a match, then the match is processed and the server replies with the first page of the site (usually index.xxx). Now, if the server does not find a match, then you get the dreaded page cannot be displayed page.

So where does the magic of somesite.com being changed to www.somesite.com come in? Well that comes from the first page of the site. The first page would be used to redirect incomming requests to a specific host header value (especially since one website can have any number of host header values).

Now there are a lot of details that were skipped because they were not relevant to the definition, but this is the general idea.

HTH,

-saige-

abduraooft
08-24-2007, 09:23 AM
The question of links like -
<a href="http://www.mysite.com/about.php">About</a>
... verses ...
<a href="about.php">About</a>is different and separate from the original question of www.mysite.com and mysite.com.
Oh sorry, the question aroused due to some sort misunderstanding by me on your previous post.

Anyway, I thank all for the valuable comments.
regards,
art.