Original address: http://www.cnblogs.com/roemin/archive/2011/08/19/2146015.html
------
Today I configured the virtual directory, here is my configuration method.
1 edit httpd.conf, look for include conf/extra/httpd-vhosts.conf, and delete the previous annotation symbol "#".
2 Edit httpd-vhosts.conf, I put wampserver installed in D:/wamp, so my path here is D:\wamp\Apache2\conf\extra.
Empty or annotate the contents and replace them with the following:
Namevirtualhost *:80
This is the new effort directory
<virtualhost *:80>
ServerName www.cms.com
Serveralias www.cms.com
DocumentRoot "F://workplace"
</VirtualHost>
The original default directory
<virtualhost *:80>
ServerName localhost
Serveralias localhost
DocumentRoot "D:/wamp/www"
</VirtualHost>
3 edit httpd.conf, find DocumentRoot "d:/wamp/www/", this is the default root path, but to change is not this, keep looking down, find <directory "d:/wamp/www", and then in the After </Directoory> add the following content:
<directory "F://workplace" >
options Indexes followsymlinks
allowoverride all
& Nbsp; order Allow,deny
allow from all
</ directory>
<directory "d:/wamp/www" >
options Indexes followsymlinks
allowoverride all
order Allow, Deny
allow from all
</Directory>
4 Modify C:/windows/system32/drivers/etc/host This file, open with Notepad, plus the following:
127.0.0.1 www. cms.com
OK, then restart Apache, enter www.cms.com in the browser, and see if the content accessed is workplace this directory.