Create subdomains on the fly with .htaccess (PHP)

后端 未结 9 1690
情深已故
情深已故 2020-11-22 02:07

I am looking to create a system which on signup will create a subdomain on my website for the users account area.

e.g. johndoe.website.com

I think it would

9条回答
  •  萌比男神i
    2020-11-22 02:08

    Mod_vhost_alias is the right module to do this.

    With one line you can tell Apache to look at the right place, with directory hashing, etc. For example, the line:

    VirtualDocumentRoot /http/users/%3.1/%3.2/%3
    

    would tell Apache to set the document root to /http/users/s/u/subdomain when requested for subdomain.yourdomain.com

提交回复
热议问题