I’m planning to build a webapp where users can show off their data. I want our users to be able to show it off on their own site, just like cloudapp. You can set your own domain name, but still use the application’s hosting service.
So my service is http://example.com/showoff but I want users to have the option to use http://showoff.example.net for their data.
I’m planning on doing it in PHP, but i’m open for suggestions if it comes to building this kind of service.
Let’s assume your domain is “showoff.com” and their domain is “acme.com”
You have two basic options: “showoff.acme.com” or “acme.showoff.com”. I have done this both ways.
For “showoff.acme.com”:
For “acme.showoff.com”:
In both scenarios, in your PHP you can find out what domain was requested with
$_SERVER['HTTP_HOST']. You will want to check this against your database of recognized domains, to determine which customer’s data to show.As you can see, most of the work is in DNS and Apache; it doesn’t really matter whether you use PHP or some other language.