如何动态创建子域 [英] How to dynamically create subdomains

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

问题描述

我想在我的网站上动态创建新的子域。我的意思是,如果你有example.com,那么你动态地创建sub.example.com。

I want to dynamically create new sub domains on my website. i mean if you have example.com then you dynamically create sub.example.com .

我看着谷歌,没有什么真的很好。我下载了一些脚本,但都没有工作。我的网站是基于php所以请,如果有反正我可以在php告诉我,而且如果它可以与python然后那是真棒!

i looked on google and there was nothing really good. i downloaded some scripts but they were all not working. my website is based on php so please if there is anyway i can do it in php tell me, and also if it can be possible with python then that is awesome!.

推荐答案

您需要设置通配符子域。基本上,anything.mysite.com将会解决mysite.com。在这一点上,取决于用户正在查看的子域,您的代码可以启动并提供正确的内容。

You need to setup a wildcard subdomain. Basically, anything.mysite.com will resolve to mysite.com. At that point it's up to your code to kick in and serve up the proper content depending on what subdomain the user is looking at.

http:// www。 google.lk/search?q=wildcard+subdomain

这篇关于如何动态创建子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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