从文档根目录外部提供图像 [英] Serving images from outside of document root

查看:23
本文介绍了从文档根目录外部提供图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?

假设我的目录结构如下所示:

Let's say my directory structure looks like this:

/data
    /data/images
/public

文档根目录在public"目录中.这当然行不通:

The document root is in the "public" directory. This won't work, of course:

<img src="/../data/images/1.png" alt="" />

但是也许可以以某种方式启用从文档根目录上方的目录提供图像?我想知道.

But maybe it's possible to enable serving images from directory above document root somehow? I would like to know.

推荐答案

最常见的方式是 别名:

Alias /data/ /wherever/your/data/are/

这篇关于从文档根目录外部提供图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆