我正在寻找一种在运行Apache2.2和PHP5的服务器上拥有多级子域的方法.理想情况下,解决方案将在Apache而不是PHP.
例如:
www.apps.example.com或test.apps.example.com
我之前在商业网站上看过这个,但是还没有看到任何解决方案来实现这一点.我本质上希望允许用户在任何子域之前输入www或只是输入没有www的子域.所以x.example.com和www.x.example.com都解析到同一目录.
我正在运行CentOS 5.4和Ubuntu 8.04,PHP 5.2.10和Apache 2.2
谢谢
您可以使用 PHP 语言动态地将条目添加到 apache 配置文件中,但请记住您正生活在不确定性的边缘
// add this to your httpd.conf
Include extra/httpd-vhosts.conf
// add this to extra/httpd-vhosts.conf
<VirtualHost *:80>
// with www prefix
DocumentRoot /www/example/x
ServerName x.example1.com
ServerAlias www.x.example1.com
</VirtualHost>
<VirtualHost *:80>
// without www prefix
DocumentRoot /www/example/x
ServerName x.example1.com
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2682 次 |
最近记录: |