News for hackers. Stuff that matters.
Re:Why use www? by geomark on Saturday January 30, 2016 @09:55PM (#11005023)
Where is the best place to do that? A redirect at the domain registrar, in my webserver (e.g. Apache), or in my app?
Re:Why use www? by tadfisher on Saturday January 30, 2016 @10:14PM (#11005065)
You will want the naked and www subdomains to point to the same address in your DNS configuration, and you will want to configure your webserver to issue a 301 redirect to the canonical subdomain at the HTTP layer. There are several reasons for this, but the most pressing is that it does not make sense to use a CNAME record for the naked domain.
Re:Why use www? by kuschku on Sunday January 31, 2016 @09:23AM (#11006467)
If you have a larger setup, you’d want to already serve the 301 on your load balancer.
Re:Why use www? by crikli on Saturday January 30, 2016 @10:11PM (#11005060)
There's a slight advantage to doing it at the registrar because it keeps the hit off your servers. This is assuming of course that http://foo.com/bar will get redirected to http://www.foo.com/bar rather than just having everything redirected to the http://www.foo.com.

Edit: I'm wrong. See tadfisher's comment below.

Re:Why use www? by tadfisher on Saturday January 30, 2016 @10:17PM (#11005074)
Note that the usual method for doing so (a CNAME on the bare domain) prevents you from adding other resource records (such as MX) on the domain.

1. http://joshstrange.com/why-its-a-bad-idea-to-put-a-cname-rec...

Re:Why use www? by jrapdx3 on Sunday January 31, 2016 @12:48AM (#11005391)
That's interesting. Currently I have 2 different domains at 2 different registrars. In each case I have the bare name, www and other subdomains as "A" records, not CNAME.

So it doesn't matter if people use the www prefix or not, since both point to the same IP. And with this configuration I've had no trouble with MX records.

If the goal is www/no-www transparency, there are other ways to do it, but using a simple DNS setup seems like the least hassle.

Re:Why use www? by tadfisher on Thursday February 04, 2016 @11:55PM (#11039541)
The main reason to redirect to one or the other is to have a canonical URL scheme for search engines.
Re:Why use www? by crikli on Saturday January 30, 2016 @10:21PM (#11005081)
Great point. And candidly I never actually do this myself (CNAME on the bare domain), I just point it at the server and let apache/nginx handle the redirect.
Re:Why use www? by geomark on Saturday January 30, 2016 @10:50PM (#11005145)
Yes, this is the problem at my registrar if I setup a redirect there. Everything gets redirected to www.foo.com instead of www.foo.com/bar.