1、添加虚拟目录的节点
在httpd.conf文件中,找到<ifModule>然后在其后面添加新的目录节点
格式如下:
<ifModule dir_module>
#directory相当于是欢迎页面
DirectoryIndex index.html index.htm index.php
#你的站点别名
Alias:myblog: "D:/myblog"
<Directory D:/myblog>
#这是访问权限设置
Order allow,deny
allow from all
</Directory>
</ifModule>
2.注销DocumentRoot路径
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
3.重启Apache
4.测试
http://localhost:80/myblog/