10

I have a project in mind that will offer users their own domain, like tumblr does for example.

I want to find a provider that can provide:

  • One top domain. eg: myproject.com
  • Unlimited subdomains. eg: a.myproject.com, b.myproject.com, ...
  • An API to create subdomains automatically
  • At a reasonable price (if possible).
eliocs
  • 18,511
  • 7
  • 40
  • 52

1 Answers1

13

no need for an api to create subdomains automatically this can be done with pure DNS on the server.

First select a provider, my fav http://mediatemple.net/webhosting/dv/ $50/mo

(So many providers to choose from most all of them allow for unlimited subdomains, hostgator's hatchling has one primary domain with unlimited subs $3.96/mo http://www.hostgator.com/shared.shtml)

Next in your DNS add an A record like:

*.myproject.com.

NOTE: any reserved records like mail, cpanel, www, etc will over ride the wildcard.

Now all subdomains will be piped to your websites index file

then in your index.php (this example uses PHP)

$url = 'http://en.example.com';

$parsedUrl = parse_url($url);

$host = explode('.', $parsedUrl['host']);

$subdomain = $host[0];

Now you have your subdomain. in your application!

Tim Wickstrom
  • 5,476
  • 3
  • 25
  • 33
  • @TimWickstrom.com hi Tim will adding A record like: *.myproject.com with ip x.x.x.1 server 1 reaches it load so i am adding additional server *.myproject.com with ip x.x.x.2 will this work. I am having similar type of question can you please check out http://webmasters.stackexchange.com/questions/45284/creating-unlimited-sub-domains-programmatically-through-api – Sam Mar 20 '13 at 06:30
  • NOTE: any reserved records like mail, cpanel, www, etc will over ride the wildcard. Do you meant that these will not work now? – Amol Ghotankar Jun 26 '16 at 18:24