【发布时间】:2011-11-08 09:43:42
【问题描述】:
我正在使用 XAMPP,Apache 2.2.17。我添加了虚拟主机,但我的虚拟主机和本地主机都指向同一个位置。这是我在 httpd-vhosts.conf 中的代码
<VirtualHost www.domain.tld:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot "C:/xampp/htdocs/workspace/testsite"
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp"
ServerAlias localhost
ServerName localhost
</VirtualHost>
通过上面的代码,我得到了带有 www.domain.tld 的测试站点,这很好。但是如果我输入 localhost,它也会进入测试站点。如果我在测试站点之前移动,那么 localhost 会转到 localhost good 并且 www.domain.tld 也会转到 localhost。我尝试了 localhost 的不同设置,就像
<VirtualHost *>
<VirtualHost localhost:80>
并从 domain.tld 中删除 *.domain.tld 但没有任何效果。我错过了什么明显的东西吗?
【问题讨论】:
标签: xampp virtualhost