I'm having a SaaS site developed and will be offering white label service with some memberships. During user registration I will be asking users to enter a 'username' which will be used for a subdomain ie;

username.example.com. 

If I begin creating subdomains after registration using the username they entred, what steps do I have to take to let a user white label their domain. I know they'll need to add a cname record to point a domain or subdomain to the subodmain on our server. But what other steps do I have to take on my end to make it all work?

link|improve this question

43% accept rate
feedback

1 Answer

up vote 0 down vote accepted

I don't really get what you mean by 'white label' but I know a lot of sites who give out free subdomains do it like this

They create a directory for everyone who subscribes and make their webserver redirect all subdomains to folders in the root web site.

Example:

user.myservice.com --> myservice.com/user

To make this work, you need to redirect all subdomains (wildcard * or @ depending on the DNS host) to the server. Finally you need to set up Apache like this:

RewriteCond %{HTTP_HOST} !^domain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)
RewriteRule ^(.*) /%1/$1 [L]

If you wan't people to be able to use your service in their own DNS-environment, you need to add it as a vhost. Example:

<VirtualHost>
  DocumentRoot /www/user
  ServerName user.domain.com
  ServerAlias *.user.domain.com
  ServerAlias usersowndomain.com
  ...
</VirtualHost> 
link|improve this answer
Hi, what I meant was to allow members to user their own domain www.customerdomain.com point it to customer.myapplication.com, so they can login from www.customerdomain.com. With that rewrite condition do I have to setup virtual hosts for each subdomain pointing them to my root folder? – Anagio Nov 6 '11 at 9:48
Added it above. – Bart De Vos Nov 6 '11 at 9:59
feedback

Your Answer

 
or
required, but never shown

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