12

I am curious as to how web-applications are able to create sub-domains instantly for new users, for example, newuser.wordpress.com, or example.blogspot.com. If I need to create a new subdomain for a website it usually requires that I log onto the DNS control panel and create a subdomain manually.

I have read examples about wildcard DNS and subdomains but that doesn't seem to answer the question about how a logged in user can create their own subdomain. I imagine that using the .htaccess file one could rewrite the URL to load a subfolder associated with a specific user.

The solution that I would consider would be to use a service like Amazon Route 53 and create new subdomains using the API. I'm not sure if this would be considered a good solution.

Additionally Tumblr allows you to point your domain name to their IP address or 'domains.tumblr.com'. Does this mean Tumblr have their own Domain Name Servers to handle these requests?

1
  • 1
    nathangiesbrecht's answer is correct. You can easily add a wildcard DNS entry using a CDN like CloudFlare. See this, and this for WordPress sites.
    – dan
    Jan 30, 2015 at 0:54

1 Answer 1

14

You're right that the trick is a wildcard DNS entry (indicated with asterisk) . Essentially it's a DNS entry that will match all subdomains that don't have a specific DNS entry. Then the "routing" happens on the application/website side. There is no actual DNS entry created for the subdomain, the reason that it finds a "match" when a DNS request is made, is because the DNS server is returning the IP address for the wildcard DNS entry for the domain.

To see an example of this in the real world, you can take a look at how Wordpress Multisite works with a wildcard DNS entry (note: many shared hosting providers will not allow you to create a wildcard DNS entry). Because the "routing" is happening at the application, not DNS level, it also allows you to map custom domains to sub-domains, if you like (like they offer at wordpress.com).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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