What is the difference between the http://website.com and http://www.website.com URL of a website? [duplicate]
Possible Duplicate:
What’s the point in having “www” in a URL?
Hello, I have little to no experience owning a website but I am willing to learn all that there is to this process. However I am frustrated because I am constantly blocked by simple problems.
I just uploaded my first index.html page which is basically a background color and a title image开发者_Go百科. I put my favicon in the public_html directory right next to index.html. I immediately notice that it does not work. I also notice that I have typed http://website.com in the URL bar. I type "www" before "website" and the favicon shows up. I hit back and the favicon is blank again. What is the difference between the non-www version of the site and the www version of the site? Why does the favicon not show up? What other differences are there? Should I disable the non-www site like many professional sites seem to do? How do I do this? What are the advantages and disadvantages, if any?
Thank you.
The www-subdomain is just a convention amongst websites to indicate this address points to a World Wide Web server.
For example,
- google.com is the top domainname of the Google company.
- www.google.com indicates this is the domain name for the World Wide Web,
- ftp.google.com indicates this is probably an ftp-server.
But as it is just a convention, and the average user uses the internet mainly for www, most servers configure their http://domain.com to be aliases to http://www.domain.com.
Why the favicon on your site only shows up for the www-version and not for the topdomain, depends on your html and your server configuration. Can you post some code or link to your site?
The fully qualified domain names are different. So they are different websites.
Usually the two hostnames will point at the same IP address, and the server will be confiured to either serve up the same content for both or redirect from one to the other.
Redirecting from on to the other (and which way round you do it doesn't really matter) is generally considered good practice as it lets you be consistent (and saves you from issues such as XHR requests to a specific hostname breaking when used on the alternative).
The favicon not working is likely caused by your browser having cached that http://www.example.com/favicon.ico didn't exist and it not having yet checked again. http://example.com/favicon.ico, OTOH, is a different URI so it would have checked it the first time you went there (which was after you created the icon file).
Typically most of the server domain manager software like Cpanel and Plex are configured to serve same site for both domains. Cpanel do have a public_html
and www
separately, but same content.
精彩评论