2015-09-27 244 views
0

我正在使用php編寫一個Web應用程序,但我不知道如何直接從本地訪問我的網站。Wamp的虛擬主機配置

我在配置Apache虛擬主機,但仍然沒有工作,

<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> 

我還添加了相同的服務器名條目主機文件

當我嘗試訪問我收到以下錯誤

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

能否請你幫我這個

+0

可能重複http://stackoverflow.com/questions/15717739/wamp-server-virtual -hosts-configuration) – jlocker

+0

我做了同樣的事情,但仍然無法訪問 –

+0

您是否嘗試將別名添加到主機文件? – jlocker

回答

1

打開hosts文件(以管理員身份)在C:/在Windows/System32下/驅動器的/ etc /並添加以下行(不要刪除任何東西)

127.0.0.1 myWebsite.local

變化myWebsite.local按你的名要求

[WAMP服務器虛擬主機配置(的
+0

我做了同樣的事情,但仍然是相同的問題 –

+0

它現在工作。謝謝 –