Other than for historical reasons, is there is reason to have “www” in a URL.
Should I do a permanent redirect from
www.xyz.com? Which one would you suggest and why?
migrated from stackoverflow.com May 27 '10 at 9:30
One of the reasons why you need
Suppose for the purposes of this example that you are running a big site and contract out hosting to a CDN (Content Distribution Network) such as Akamai. What you typically do is set up the DNS record for your site as a CNAME to some
The quirk of the DNS is that if you have a CNAME record for a host name, you cannot have any other records for that same host. However, your top level domain
The use of
One good technical reason to make
Now, this often makes sense but it’s positively harmful if you only want to download static resources. Consider all the style sheets and images on your website: usually, there’s no reason to send cookies to the server when requesting an image resource.
A good solution is therefore to use a subdomain for static resources, such as
Now this isn’t relevant for most sites but changing your canonical URL later on isn’t a good idea so once you settled for
An alternative is to use a whole different URL for static resources. Stack Overflow for example uses
I'd do the first. The
If you are going to have subdomains for other purposes (blog for instance), you may want to differentiate the sites and have a
It's pretty historical. Once upon a time we used to have www.example.com, ftp.example.com, images.example.com, uk.example.com etc which seemed like a logical thing to do and provided a simple method to spread the load between servers.
These days I would just go for example.com for the main site and redirect the www version to that.
The Google Webmaster tools allow you to specify your preferred domain, so make sure you use those too.
Most servers send the same site either way, but don't redirect. For SEO purposes, choose one, then get the other to redirect to it. For example, some PHP code to do this:
However, some reasons promoting the use of a