I have a website where users register domain.com/user/username. I'd like to add a feature where users can search for and purchase a domain name that maps back to that URL.

I'm not sure how big of a task this is - can anyone provide an explanation of what's involved?


You'd have to either resell domain registrations, hook into a registrar's API, or become ICANN-accredited (which costs thousands of dollars I believe) - the most practical option would be to find a good, ICANN-accredited registrar (such as name.com or Namecheap or Enom) and use an API.

For example, Namecheap.com has a developer's API that will let you register and manage domains:


I should point out that APIs like this will register domains to YOUR account, not your customer's individual accounts. So if you secure payment from the customer first, you can register the domain to your (business?) account on a registrar automatically via an API. Then, you can use the same API to manage the domain's settings, such as pointing to their URL on your site.

For billing and payment, I'd look into Google Wallet or PayPal (or better yet, both). You just have to write code that receives some data from their checkout endpoints and do your own processing (save to a database, send confirmation emails, register the domain, etc).

So, it's not too far-fetched. If you have some time and a little financial means (mostly to cover labor/coding costs) it should be fairly straightforward. Just find a developer who really knows what they're doing that you can trust (as always).

  • Once the domain is registered, propagated, and pointed, will each page in the directory on the original domain appear on the new domain? I'm not looking for a redirect; more like virtual hosts in xampp or mamp. – Chords Jan 16 '12 at 2:51
  • 1
    Great answer, I had been wondering how Google Apps managed to achieve this. I even asked a GoDaddy rep and he had no clue. – Vigrond Jan 16 '12 at 7:48
  • 1
    Hm, good question. It's not possible with .htaccess/Apache locally (that'd be quite the security doozy), but I think there's ways to achieve this via the registrar and URL forwarding/redirects. There are lots of different types (A, CNAME, AAA, URL Frame, etc) -- I'm not familiar with them all, but I think URL Frame is the one that is closest to doing what you want... hm, time to Google this. – Matt Jan 16 '12 at 19:02
  • Great answer. I was searching for some direction & you gave one :) – RajeevK Oct 6 '13 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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