2012-01-14 67 views
1

我修改了我的etc/hosts文件(在Windows 7下),以便www.example.comdemo.example.com都指向localhost。不幸的是訪問demo.example.com,把我帶到本地主機的文檔根目錄(這是合乎邏輯的)。我想改變這點demo.example.comdemo.localhost,所以在localhost上創建一個新的虛擬子域,然後etc/hosts文件應該這樣做。如何在本地機器上添加子域名

任何人都可以指向正確的方向嗎?我有這個虛擬主機文件,它有一個有效的語法,但似乎沒有按我的意思工作。

<VirtualHost 127.0.0.1:80> 
ServerPath /demo-example/ 
ServerName demo.example.com 
</VirtualHost> 

回答

1

嘗試改變這樣

<VirtualHost 127.0.0.1:8080> 
    ServerPath /demo-example/ 
    ServerName demo.example.com 
</VirtualHost> 
+0

不,還是'demo.example.com'將端口號'example.com' – 2012-01-14 20:34:09

+0

嘗試添加指令 '了NameVirtualHost' 爲'了NameVirtualHost * '在虛擬虛擬主機指令之前。閱讀此鏈接[subdomain conf](http://content.websitegear.com/article/subdomain_setup.htm) – 2012-01-15 05:46:42

+0

鏈接格式有什麼問題? – 2012-01-15 05:49:07