且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-12-05 21:33:27

您需要调整您的服务器软件第一。
?用户= 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.