PHP:为每个用户使用htaccess的动态子域

编程入门 行业动态 更新时间:2024-10-19 03:30:46
本文介绍了PHP:为每个用户使用htaccess的动态子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是有可能创造使用htaccess的每个用户的动态子域。例如,如果用户名为名为myusername用户,然后添加子域名的他像HTTTP://www.myusername.example,当有人加载此页它应是的 www.example/?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, and when somebody load this page it should come as www.example/?user=myusername ( using htaccess )

推荐答案

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

You have to tune your server software first. ?user=myusername is a path at the host www.example while www.myusername.example is another host A browser have to know which IP address should be called for www.myusername.example 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的动态子域

本文发布于:2023-10-31 16:03:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546582.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动态   用户   PHP   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!