如何使用php以编程方式创建个人子域 [英] how do i create personal sub domain programmatically with php

查看:83
本文介绍了如何使用php以编程方式创建个人子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想按用户创建子域,那么从技术上讲我该怎么做?
例如,如果用户XXX已注册到我的网站,并且我将与该子域名相关联的子域 http://xxx.mydomain.com/ http://www.mydomain.com/xxx/
制作的程序是什么?

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 ?

推荐答案

您需要设置通配符DNS记录以捕获所有子域并将其发送到Web服务器.

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

然后,您需要设置Apache以捕获所有命名的虚拟主机并将其发送到目录.

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

在目录中,您将设置htaccess以将所有请求发送到一个脚本,该脚本将从服务器变量中读取子域并进行相应处理.

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.

这篇关于如何使用php以编程方式创建个人子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆