PHP:为每个用户使用htaccess的动态子域 [英] PHP : dynamic sub domains for each user using htaccess

查看:113
本文介绍了PHP:为每个用户使用htaccess的动态子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是有可能创造使用htaccess的每个用户的动态子域。例如,如果用户名为名为myusername用户,然后添加子域名的他像HTTTP://www.myusername.example.com,当有人加载此页它应是的 http://www.example.com/?user=myusername (使用htaccess的)

is it possible to create dynamic sub domains for each user using htaccess. for example if there is a user with user name myusername, then add a sub domain for him like htttp://www.myusername.example.com, and when somebody load this page it should come as http://www.example.com/?user=myusername ( using htaccess )

推荐答案

您需要调整您的服务器软件第一。
?用户= MyUserName的一个路径在主机www.example.com
而www.myusername.example.com是另一个主机
浏览器必须知道哪些IP地址应要求www.myusername.example.com域。

You have to tune your server software first.
?user=myusername is a path at the host www.example.com
while www.myusername.example.com is another host
A browser have to know which IP address should be called for www.myusername.example.com domain.

因此​​,首先你必须建立一个 DNS记录,以使所有子域名的别名主域名。
接下来,你必须设置你的Web服务器软件,以接受所有子域。
最后,你可以处理任何子域的请求。没有任何的.htaccess参与。

Thus, first of all you have to set up a DNS record to make all subdomains an aliases to main domain.
Next, you have to set up your web server software to accept all subdomains.
And finally you can process any subdomain request. no .htaccess involved.

有关详细信息 - 请参阅无数同样的问题$ P $这里pviously回答了SO

For the details - refer to numerous same questions previously answered here on SO.

这篇关于PHP:为每个用户使用htaccess的动态子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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