apache配置虚拟目录
在项目下文件里面访问 D:/test目录下的文件。
apache安装目录:
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\mypro,
mypro/test.html文件:
在这个html里面要引用D:/test/1.jpg
<html><body>
<h1>my pro!</h1>
<img src="/test/1.jpg"></img>
<img src="http://localhost/test/1.jpg"></img>
</body></html>
浏览器中:http://localhost/mypro/test.html 再加入如下配置后可以访问图片:
在httpd.conf中添加如下代码:
<IfModule dir_module>
#相当于欢迎页面
DirectoryIndex index.html test.html
#站点别名
Alias /test "D:/test"
#访问权限设置
<Directory "D:/test">
Order allow,deny
Allow from all
</Directory>
</IfModule>