Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
1  
Ahh, thank you! This is an awesome start. And the added vocabulary - wildcard subdomains - makes this a much easier topic to Google! –  user2129607 May 29 '13 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.

share|improve this answer
    
That's the Wildcard DNS record method i mentioned earlier. –  StashX May 30 '13 at 7:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.