I recently got a domain registered through Namecheap. I successfully set up mail.mydomain.com to redirect to my organization's Google Apps Gmail by setting up mail to point to ghs.google.com. My question is how does Google know that I want it to go to Gmail and not Calendar? Granted, it's obvious in this case, but what if I were to point a "foobar" subdomain to ghs.google.com? What would it do? I'm a web developer, but I hardly ever do anything with server configuration. Thanks!
Google server @ ghs.google.com looks at the incoming request. if it is say - cal.yourdomain.com, it serves calendar and if it is mymail.yourdomain.com, it serves gmail.
What happens is
How does google know to do this? You specify this on the dashboard at - https://www.google.com/a/cpanel/yourdomain.com/DomainSettings#ServiceSettings/service=calendar&subtab=0
and choose "Change URL"
You will need to do this for every service you use. Make sure you create appropriate CNAME records with your DNS service provider.