To Create Dynamic Subdomain For Each User And Also Allow The User To Map It To His Own Domain


i am very new to yii and i am working on a project with the following requirments…

the main site( allows users to create register and on registration they get a subdomian i.e

now every user who registers gets a subdomain and if the user wishes he must be able to map it to his own domain name i.e… (just like

i have no idea how to get this…so any king of help or pointer in the right direction is appriciated…

thank you

/* moved to General Discussion */

Check out this wiki to get started… Good luck.

Hi dhruva, welcome to the forum.

I think it’s rather a challenge in a different layer from the PHP framework.

I don’t have much knowledge in this, but I guess you have to control the settings of the domain name server from your program.

@everyone: Correct me if I’m wrong.

You’re right, it’s not only a PHP issue. However the DNS and Web servers can be configured to respond to any subdomains under the main domain, so Yii can redirect to the right place using URL management rules. It’s not trivial work but not overly complicated either.


Thank you JFReyes,

Just for confirmation:

Do you say that when we add/remove/change our users and their subdomains, we don’t need to touch anything in the DNS and the web server once they are configured properly?

… Ah, OK. I’ve found. “Wild card” in A record of DNS + mod_vhost_alias of apache … Am I right?

You got it :)

It’s a bit tricky to get right in both places (DNS & Apache/nginx) but once it’s set up it works fine, so one can concentrate on Yii’s URL management using host parameters.

thanks a lot for the info guys…i am working on it and will post again if i have any doubts…