I have this site where a user selects a template for his site. I have to create a sub domain for that user on my site which will apply the selected template. My question is can I create a subdomain programmatically if yes then how? I am using cakephp. I want that users site will be accessible on some url after selecting a template.
Share
Well, if you’re running your own DNS servers, you can programmatically append new sub-domains to your DNS configuration files. I would probably not recommend that.
What most sites (like WordPress.com and what not) most likely do is setup their DNS to point
*.wordpress.comto their web server, then programmatically see if the sub-domain matches a valid account, then respond accordingly.Most DNS servers support wildcard domains, such as:
so consult your manuals or help files for whatever DNS service you’re using. Hope this helps!