Apache 子域重定向到www

Apache 子域重定向到www,apache,redirect,subdomain,Apache,Redirect,Subdomain,我在apache服务器上运行了域example.com和test.example.com。由于某种原因,当我尝试访问test.example时,它被重定向到www.test.example,因此浏览器中会显示服务器未找到错误。.htaccess(根文件夹和子域文件夹)文件均为空 其他事实 我有另一个子域xyz.example.com指向public_html/xyz目录,其中包含一些内容(index.html带有“hello world message”),如果我使用xyz.example.co

我在apache服务器上运行了域
example.com
test.example.com
。由于某种原因,当我尝试访问test.example时,它被重定向到www.test.example,因此浏览器中会显示
服务器未找到
错误。.htaccess(根文件夹和子域文件夹)文件均为空

其他事实

我有另一个子域
xyz.example.com
指向public_html/xyz目录,其中包含一些内容(index.html带有“hello world message”),如果我使用xyz.example.com而不是www.xyz.example.com,它可以正常工作。那么,你能帮我按顺序指出正确的方向吗。我有一个vps,如果需要,我可以更改任何文件

下面您可以找到我的虚拟主机配置

<VirtualHost xx.xxx.xxx:80>
    ServerName test.example.com
    ServerAlias www.test.example.com
    DocumentRoot /home/example/public_html/test
    ServerAdmin webmaster@test.example.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/test.example.com combined
    CustomLog /usr/local/apache/domlogs/test.example.com-bytes_log "%{%s}t %I  .\n%{%s}t %O ."

    ScriptAlias /cgi-bin/ /home/example/public_html/test/cgi-bin/

    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/example/test.example.com/*.conf"

</VirtualHost>

ServerName test.example.com
ServerAlias www.test.example.com
DocumentRoot/home/example/public\u html/test
服务器管理员webmaster@test.example.com
UseCononicalName关闭
CustomLog/usr/local/apache/domlogs/test.example.com组合
CustomLog/usr/local/apache/domlogs/test.example.com-bytes_log“%{%s}t%I。\n%{%s}t%O。”
ScriptAlias/cgi-bin//home/example/public\u html/test/cgi-bin/
#要自定义此VirtualHost,请在以下位置使用包含文件
#包括“/usr/local/apache/conf/userdata/std/2/example/test.example.com/*.conf”

感谢您在bind config zones(绑定配置区域)中花费的时间,您不需要设置子域测试 在example.com区域中添加此行>>

test.example.com         IN        A         (xxx.xxx.xxx.xxx)
xxx.xxx.xxx.xxx是您服务器的ip

或者您没有启用虚拟主机配置>>

a2ensite test.example.com 

test.example.com是虚拟主机文件的名称。

我已选中第一个选项,它是正确的。那么,如何启用(如果不是)虚拟主机?