Reputation: 2133
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.
Upvotes: 6
Views: 2265
Reputation: 91608
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.com
to 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:
*.yoursite.com. 3600 IN MX 10 host1.yoursite.com.
so consult your manuals or help files for whatever DNS service you're using. Hope this helps!
Upvotes: 9