How Do Web Apps Create Subdomains?

web-applicationsweb-development

I want to understand the architecture of web apps that use subdomains. I don't think that I'm phrasing this well, so let me explain.

Many web apps, like tumblr or shopify create a user's site on a subdomain. Say for example my tumblr account was johndoe then you could find my tumblr blog at johndoe.tumblr.com. Can someone explain how this is implemented?

Best Answer

Basically you could either set new CNAME record to your DNS server for each user (if you have such ability by your Hosting/DNS server provider) or use the Wildcard DNS record method and then use some rewrite rules to process the requests.

You can read more about it on this older post in stackoverflow.

Related Topic