I've produced a website builder application, where site site visitors can take shape their websites by themselves using my website. Presently, each site url is much like this:

world wide web.sitebuilder.com/sites/site_id=18

Things I want would be to enable each user to possess a real domain for his or her site. For instance, when the user with site_id=18 wants a brand new domain title as:

world wide web.newdomain.com

Then world wide web.newdomain.com should show this content of world wide web.sitebuilder.com/sites/site_id=18

But it shouldn't be carried out by sending. Any ideas regarding how to get it done ?

The A records for world wide web.newdomain.com and (most likely) newdomain.com will have to be pointed your server (if you do not know this already/know what this signifies, I believe it is important you need to do a minimum of just a little reading through how DNS works). Then you've two options:

  • Perhaps the greater and much more generally used approach is by using virtual hosting in your web server (with something similar to Apache's mod_vhost_alias), and configure the server in a way that after it gets to be a request confirmed domain, it serves the right files - from the feel of the way in which your URL plan presently works, this is a under simple task without drastically altering your architecture, and you should understand what you had been doing.
  • You should check the domain which was accustomed to access the website from inside PHP (using $_SERVER['HTTP_HOST']), and serve the right files according to this. This could most likely be simpler to setup, however i personally would contemplate it less sustainable in the long run - this really is my own opinion and YMMV, it's a subject that may most likely be debated for hrs (although SO isn't the place for your debate).

It is dependent on which type of hosting setup you've. Anytime I have seen this (where you'll need a domain planned straight to a path and never make use of a redirect of any sort) that should be handled through the after sales from the host usually through manual adjustment from the configurations.

For instance, so how exactly does a person even obtain own URL? Clearly they will not visit GoDaddy and purchase their very own – you most likely offer it as being something and take proper care of the registrar stuff by yourself.

Hate to express it, however, you may have to by hand map a website towards the correct folder around the server space each time a user purchases one. I am certain domain process is not 100% automated presently, so what's an additional a few minutes of labor in some places? Just setup a script that'll shoot an email when someone will pay for a website that reminds you to definitely result in the necessary after sales changes. After which tell a person and alter will require 24-48 hrs to implement initially.