WWW.example.com or HTTP://example.com – which one is futureproof?
Personally I would put example.com
on contact cards,etc and have it redirect to www.example.com
. This can be done with a simple rewrite.
The reason for this is that my users should never be concerned with having to type www
. I absolutely hate sites that require people to type the www
- I think it's a completely outdated requirement from years gone by.
You would, however, want to 301 redirect from example.com
or www.example.com
. In fact, to anything. The point is to pick your favourite and set all the different ways to get to your site to redirect to the same place so that you aren't penalised for dupe content (I can't remember the SEO term).
The protocol is useless, since browsers will put it in for you (in fact, Chrome doesn't even show it).
Another reason that I have everything redirect to www.example.com
is due to cookies. For example, the cookies on www.example.com
will be completely separate from static.example.com
but any cookie set on example.com
will be sent with the HTTP request to sub1.example.com
, sub2.example.com
, etc. Although this is just my preference.
I personally prefer the www
domains. As one of @Jonathon's points, the real main reason is with cookies. When you have example.com
and you apply a cookie to it, that cookie governs all sub domains such as www.example.com
, foo.example.com
and bar.example.com
which can cause you headaches in the future if you're dealing with sessions or security.
You can always have a example.com
redirect to a www.example.com
on the server side so when it comes to print media or linking with other sites, the less there is the better. A user will not bother to remember the www
of www.example.com
so its useless information and I would go as far as to say that the attempt to do so will make the user unhappy, thereby making them avoid your site altogether.
If you're interested/are using the framework, I can supply the code for such a redirect in the form of an ActionFilterAttribute
for ASP.NET MVC (I spent 2 days perfecting the filter on my own, so I'm feeling pretty confident about it).
On another note, when it comes to the actual code on your site, don't skip out on details. Meaning, don't try to take http://www.example.com/Something/Something-Else
into example.com/Something/Something-Else
.
- It's not going to work because the browsers don't understand protocol-less links.
- Even if they did, the second Uri will cause a
redirect to the
www
version if you're normalizing, resulting in a pointless round trip back to the server.