Hey hey!

I'm about 70% into completing a web application that will allow our clients to white label our service. They can then in turn resell the service to their audiences without any involvement from me or my colleagues. Now, something I need to figure out is how to allow my clients to set their own domain name from within their settings so that their users can reach our service using our clients custom domain?

Our clients are not permitted to see the source at all, so rather then allowing them to download the package I'd like to allow them to setup a custom domain name that points to our webserver. Just an insight as to why this is pretty much my only option.

I'm currently thinking that the best way to do this is to use mod_rewrite or possibly CNAME records (which I believe can be modified automatically using my registrars API?).

Could I please have some feedback from the seasoned programmers amoungst you? All I would want my client to have to do is to A) set their domain name in their settings and B) set an IP address in their chosen domains A records. Then after 12-72 hours it should be active.

Example:
1) Bobs audience currently visits bob.mybrand.com, but he wants to use bob.com!
2) Bob goes into his settings and enters bob.com into the custom URL field.
3) Bob is then presented with an IP address (or should he get name servers?) to configure bob.com with
4) 12-72 hours later Bobs audience can visit bob.com OR bob.mybrand.com to get to our services.

Sorry for the long winded explanation - I just wanted to make sure everyone was clear :)

I'm open to suggestions and solutions,
Michael McDonald

Okay for anyone who needs this in the future. It's come down to me creating a wildcard CNAME record and then telling users to point their domains to bob.mywebsite.com. Then I'll use code like this to collect the value of the subdomain in order to pull up the correct site settings for that user:

$url = '$_SERVER["REQUEST_URI"]';
$parsedUrl = parse_url($url);
$host = explode('.', $parsedUrl['host']);
$subdomain = $host[0];

Using bob.example.com, $subdomain would have the value of bob.

Thanks to JorgeM for helping my get my head around this process!

This thread is solved but there are more on it. How wildcard subdomains solve the problem that you describe to let bob.mywebsite.com become bob.com ?.

For me that is the interesting point and I am going to face it in a month or two. What I have figured till now is that I will not mess directly with httpd.conf (speaking for apache server) and that I will make a client panel script (e.g. cPanel Script) that will perform that operation.

Of course the sequence will be in reverse order from what you are describing, I will give them the appropriate name servers and they can add the domain only and if I can verify that this domain points to the appropriate NS.

I haven’t done it yet, I am gonna , and if there is anybody here that has done it , any advices are more than welcomed.

If you want bob.com to point to your resource, the customer is not going to generally delegate their domain to your NS servers. What they would likely do is simply create an alias record for the domain name and point to your resource (your web server). At least, if I owned bob.com, I wouldnt use your NS servers.

What you can do to verify that bob is the owner of bob.com for security reasons, have bob create another record in his zone and you provide the value for the record. If bob is able to create this additional record, bob has proven that he has the appropriate access to manage his own zone.

the challange with bob.com is that when you receive the traffic on your web server for bob.com, how to identify which customer bob.com belongs to on your site.

If you have your bob use bob.yourdomain.com, you can use Michael's approach listed above.

I'm not sure on all of the details required with URL rewriting on apache and code on php so i cant provide additional guidance there. I'm only commented here regarding hte DNS portion of this process.

hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.