网站目录之外的备查文件 [英] Reference file outside of Web site directory
问题描述
我如何引用文件我的网站的根目录之外?
例如我的网站是位于C:\\ dev的\\测试网站
我使用ASP.NET与XSP。 web应用程序将在Apache使用的是mod_mono进行部署。
我必须用C图像:\\图片,我想做到这一点:
< IMG SRC =C:\\影像\\ logo.gif/>
您 IMG
标签的的src
值是怎么回事要被发送到客户端。您需要指定相对您的文档根目录的路径。最好的办法就是建立一个虚拟文件夹(在IIS中,别名是Apache当量)指向 C:\\图片
路径,然后更改提及的标记的src
路径如下:
< IMG SRC =/图像/ logo.gif/>
要做到这一点在Apache中,你需要在httpd.conf的别名。该行看起来像这样
别名/图像C:/图片
这里的文档 http://httpd.apache.org/docs /2.0/mod/mod_alias.html#alias
How do I reference a file outside my web site's root directory?
For example my website is located at C:\dev\TestSite I am using ASP.NET with XSP. The webapp will be deployed on Apache using mod_mono. I have images in C:\images and I would like to do this:
<img src="C:\images\logo.gif"/>
Your img
tag's src
value is going to be sent to the client. You need to specify those paths relative to your document root. Your best bet is to set up a virtual folder (in IIS, alias is the apache equivalent) to point to the c:\images
path and then change the mentioned tag src
path as follows
<img src="/images/logo.gif" />
To do this in apache, you need an alias in your httpd.conf. The line looks like this
Alias /images c:/images
Here's the docs http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
这篇关于网站目录之外的备查文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!