why domains like mail.google.com or music.youtube.com not work wit www

If we try to access www.mail.google.com or www.music.youtube.com. They wouldn't work. why? Also if we want how can this be achieved


Why would they?

www is nothing special. It is just one string (name, label) among any other combination, for computers it makes no difference. And not all hostnames have to start with this prefix.

When the World Wide Web was invented, it was custom to name website with hostnames starting with www. just to more easily distinguish them from other hostnames, like those of an FTP server starting with ftp. or an SMTP/POP/IMAP server starting with mail., etc.

Also if we want how can this be achieved

The owner of the zone has to create the relevant DNS records if the names need to resolve. But given the names you used as example - which are obviously not yours -, why are you concerned?