如何将多个Apache本地主机URL映射到Windows上的目录?

我已经安装了Apache,并在httpd.conf中将DocumentRoot设置为“c:\ testweb”,可以通过“ http://localhost ”获得。

我现在如何启用它,以便“ http://localhost/web2 ”转到“c:\ web2”?

这适用于我:

 Alias /myapp "C:\web2" <Directory "C:\web2" > Options Indexes FollowSymLinks AllowOverride none Require all granted </Directory> 

一个设置的例子可以在下面find:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html
http://www.nodans.com/index.cfm/2006/10/10/Apache-Directory-Aliases-and-Virtual-Directories
简而言之,你应该在httpd.conf中添加这样的内容:

 Alias /web2 c:/web2 <Directory /web2> Order allow,deny Allow from all </Directory> 

所有这一切都假定你启用了Apache的mod_alias。