how do i create personal sub domain programmatically with php

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-29 08:19:31

问题


if I like to create per user sub domain , how technically do I do this ?
for example if user XXX is registered to my site and I what to associated him the sub domain http://xxx.mydomain.com/ or http://www.mydomain.com/xxx/
what is the procedure to make it ?


回答1:


You need to setup a wildcard DNS record to catch all subdomains and send them to you web server.

Then you need to setup Apache to catch all named virtual hosts and send it to a directory.

In the directory you would set htaccess to send all requests to one script which would read the sub domain from the server variables and handle it accordingly.




回答2:


If you want mydomain.com/xxx, then that's just a folder. Some hosts will also take mydomain.com/xxx and automatically make xxx.mydomain.com point to it without needing any configuration on your part. Might want to check that this isn't already the case for you.




回答3:


How would you create the subdomain manually?

Good. Now automate it.



来源:https://stackoverflow.com/questions/4116898/how-do-i-create-personal-sub-domain-programmatically-with-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!