how do i create personal sub domain programmatically with php

后端 未结 3 2170
离开以前
离开以前 2020-12-20 06:38

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 h

相关标签:
3条回答
  • 2020-12-20 06:55

    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.

    0 讨论(0)
  • 2020-12-20 07:09

    How would you create the subdomain manually?

    Good. Now automate it.

    0 讨论(0)
  • 2020-12-20 07:11

    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.

    0 讨论(0)
提交回复
热议问题