我正在使用XAMPP,Apache 2.2.17。我添加了虚拟主机,但是我的虚拟主机和本地主机都指向相同的位置。这是我在的httpd-vhosts.conf需要帮助xampp虚拟主机
<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,它也会去testsite。如果我在测试站点之前移动,那么localhost会转到localhost,而www.domain.tld也会转到localhost。我尝试了不同的本地主机设置像
<VirtualHost *>
<VirtualHost localhost:80>
和删除*从使用domain.tld,但没有.domain.tld工作。我错过了明显的东西吗?
你可以请看看我的问题bro https://stackoverflow.com/questions/45173872/virtual-host-cannot-create-with-xampp-server? –