Wamp的虚拟主机配置


Virtual Host configuration for Wamp

我正在使用php编写一个web应用程序,但我不知道如何从localhost直接访问我的网站。

我已经在apache中配置了VirtualHost,但仍然不工作,

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/top10"
    ServerName top10.com
    <Directory "C:/wamp/www/top10" >
        allow from all
        order allow,deny
        AllowOverride all
    </Directory>
    DirectoryIndex index.html index.php
</VirtualHost>

我还在hosts文件

中添加了相同的ServerName条目

当我尝试访问时,我得到以下错误

Not Found
The requested URL / was not found on this server.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at top10.com Port 80

我想访问我的网站为http://top10.com而不是http://localhost/top10。

你能帮我一下吗

打开C:/Windows/System32/drivers/etc/下的hosts文件(以管理员身份),并添加以下行(不要删除任何内容)

127.0.0.1 myWebsite.local

myWebsite变化。