Conversation
Can anybody explain me why do lots of sites redirect me to www subdomain?

Like from example.com to www.example.com

What's the reason of this? Looks like it should work fine even without it.
3
0
0

It is obsolete tradition but some like it.

Redirecting to single domain rather than using multiple identical mirrors is a good practice for many reasons.

Nowadays it usually is just example.com however sometime long ago web servers were usually located specifically at www subdomain and this was indication of WWW (HTTP) site available there. It is mostly gone now but some people still like it for some weird reason.

0
0
1

@yura It's generally preferable to have a single canonical domain for analytics and SEO purposes. My personal preference is to do the inverse redirect (www => root), this is usually the more modern approach

The www subdomain exists mainly from a historical time before http became established as the dominant form of internet traffic, representing the web segment of a more multi-service domain https://serverfault.com/questions/1153285/is-it-better-to-redirect-root-to-www-or-www-to-root

0
0
1
@yura the apex domain should be a A/AAAA record and not a CNAME, so depending on the CDN configuration, it is often easier to have a small redirector service running on the apex domain that then redirects to the www subdomain that is the CNAME of the CDN.
0
0
0