Suppose domain is domain.name,
after a new user sign up,need to generate a new domain:user1.domain.name.
How to implement it?
BTW,is there a limit for the number of sub domains?
Suppose domain is domain.name,
after a new user sign up,need to generate a new domain:user1.domain.name.
How to implement it?
BTW,is there a limit for the number of sub domains?
I would simply use a wildcard to point all subdomains to a certain directory and have a front controller there that determines the used one from the URL - this is the easiest and safest solution from PHP.
EDIT Then you can obviously check whether that one should be existing (store them in a database or whatever) etc.
What you are asking for is known as Wildcard DNS record:
Basic DNS/Apache setup:
App-side logic (crappy code):
Subdomains can be retrieved with .htaccess (you need however wildcard mentioned earlier in this thread):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^user([0-9]{1,10}).domain.name$
RewriteRule ^.*$ index.php?subdomain=%1