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?
2 Answers 2
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.
-
1Ahh, thank you! This is an awesome start. And the added vocabulary - wildcard subdomains - makes this a much easier topic to Google!user2129607– user212960705/29/2013 18:25:31Commented May 29, 2013 at 18:25
If you could't edit your DNS record, you can also insert a subdomain which will be pointing to *.yourdomain.com
and it willl receive any subdomains, that way you will can check on your system if that subdomain inserted by the user is a valid domain, check on a whitelist array, os simply checking on the database if the user exists on the system.
-
That's the Wildcard DNS record method i mentioned earlier.StashX– StashX05/30/2013 07:03:09Commented May 30, 2013 at 7:03