Apache / 2.2.22(Ubuntu)
<VirtualHost *:80>
ServerName www.example.com # Works
ServerAlias new.example.com # Works
ServerAlias example.com # Does not work - shows apache default "It works"
DocumentRoot /usr/share/drupal7 # /tmp shows the same behavior
</VirtualHost>
所有域的相同IP(ping new.example.com = ping www.example.com = ping example.com)
编辑:
任何顶级域名的行为都是这样的...... www.test.com有效 - test.com没有...
答案 0 :(得分:0)
只需将其写在一行:
<VirtualHost *:80>
ServerName www.example.com
ServerAlias new.example.com *.example.com
DocumentRoot /usr/share/drupal7
</VirtualHost>
答案 1 :(得分:0)
您似乎已经将example.com
用于主网站,即您拥有:
ServerName example.com
外<VirtualHost>
个容器。当有几个匹配时,Apache将只检索第一个匹配。