子域名重定向到www

3
我有域名example.com和在apache服务器上运行的test.example.com。由于某种原因,当我尝试访问test.example时,它会被重定向到www.test.example并显示浏览器中的Server not found错误。两个.htaccess文件(根目录和子域文件夹)都为空。 其他事实 我有另一个子域xyz.example.com指向public_html/xyz目录,并且里面有一些内容(带有“hello world message”的index.html),如果我使用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>

感谢您的时间。
1个回答

0
在绑定配置区域时,您不需要设置子域名测试。请在example.com区域中添加以下行>>

test.example.com         IN        A         (xxx.xxx.xxx.xxx)

xxx.xxx.xxx.xxx 是您服务器的IP地址

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

a2ensite test.example.com 

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


我已经检查了第一个选项,它是正确的。那么,如果虚拟主机没有启用,我该如何启用它? - manix

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接