From technical perspective the only issue is traffic and incoming links (one of them should redirect to another).
Now I need to choose which one should be primary. Some sites have www (google, microsoft, ruby-lang) and some without www (stackoverflow, github). Seems to me the newer do not use WWW.
What to choose?
Please with some explanations.
UPDATE: This is programming related question. Actually site is for programmers, so I expect to see what techy people think.
UPDATE: Site without WWW is clear winner. Thank you guys!
It doesn't matter which you choose but you should pick one and be consistent. It is more a matter of style but it is important to note that search engines consider these two URLs to be different sites:
http://www.example.com
http://example.com
So whichever you choose for aesthetic reasons should be consistently used for SEO reasons.
Edit: My personal opinion is to forgo the www
as it feels archaic to me. I also like shorter URLs. If it were up to me I would redirect all traffic from www.example.com
to example.com
.
Don't use WWW. It's an unnecessary tongue-twister, and a pain in the arse for graphic designers.
There are some issues you should consider. See for example Use Cookie-free Domains for Components for a cookie validity issue.
But regardless of how you decide: Use just one of that domains as your canonical domain name and use a 301 redirect to correct the invalid. For an Apache webserver, you can use mod_rewrite to do that.
Configure both, obviously. I would make the www
redirect to the normal URL, as it only exists to make the people who habitually type it at the beginning of every address happy anyway. Just don't, whatever you do, require the www
to be typed manually. Ever.
It depends on your audience, I think. A non-technical audience will assume that the www
is there, whereas a technical audience will not instinctively expect it, and will appreciate the shorter URLs.
(Edit: I recently set up a domain for my family to use, including webmail. My wife asked what the address of the webmail was. I said "mail.ourdomain.com". She typed "www.mail.ourdomain.com".)
Either way, make sure the one you don't use cleanly does a 301 Redirect to the one you do use - then neither users nor search engines will need to care.
One aspect of this question deals with CDNs and some web hosts (eg. Google Sites). Such hosts require that you add a CNAME record for your site name that points to the host servers. However, due to the way DNS is designed, CNAME records cannot coexist with other records for the same name, such as NS or SOA records. So, you cannot add a CNAME for your example.com name, and must instead add the CNAME for a subdomain. Of course people normally choose "www" for their subdomain.
Despite this technical limitation, I prefer to omit the www on my sites where possible.
I'd redirect to without www. In Apache 2.x:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$
RewriteRule (.*) http://yourdomain.com/$1 [R=Permanent]
I think the www is meaningless; we all know we're on the world wide web. It would be much better to use subdomains for load balancing or for device specific sites (like m.google.com for mobiles, for example, even though there is a .mobi top level domain now).
www is used as a standard sub domain, subfolder for websites in the main domain.
http://no-www.org/ are trying to get it deprecated.
Although http://www.w3.org/ include www.
Worth checking both those sites.
It seems to be become a matter of taste and a religion issue at the moment rather than a standard. Whatever you choose, make sure you register or redirect from www as Control+enter etc. shortcuts copy in www.
Would you have other subdomains? If so, that may make using the www make more sense to my mind as some places may have various subdomains used for other purposes like a store or internationalization subdomains.
I normally go with www.sitename.com because it is explicit that it is the main part of your site. Testing.sitename.com is testing. House.sitename.com is my home PC. I like be explicit however I do not mind when sites do not use www. I am not a purest. :)
Use without the www. The general rationale behind this is that since you are writing an address to a web browser, it's already implicit that you are accessing a web site (what else would you do with a browser?) - using the extra www is therefore useless.
To be specific, when receiving a http request, you know the user wants to access the website. The web browser adds the http://-header implicitly, so user only needs to worry about the address. Same goes to other services as well - if you host ftp, it should be enough to point the ftp client to the domain without the ftp. -prefix.
If I understand correctly, the reasons for using the different www., ftp., etc. subdomains are mostly historical, and are no longer relevant these days since traffic is simply directed to the correct server/service - the redundant prefixes have just stuck because of their popularity.
I always make the non-www one redirect to www and refer to them as www.mysite; Think about various forums and instant messenging apps that correctly convert links only when they begin with www. .
You want your url to be memorable, and you want Google et al to register the same url for rankings and the like.
Best practice appears to be to handle the www, but always HTTP redirect it to a non-www variant. That way the search engines know to rank links to both variants as the same site.
Whatever you use, stick to one or else you'll have to make 2 sets of cookies for each domain to make your sessions/cookies work properly.
来源:https://stackoverflow.com/questions/1109356/www-or-not-www-what-to-choose-as-primary-site-name