访问文档根目录与Apache以外的文件 [英] Accessing files outside the document root with Apache

查看:840
本文介绍了访问文档根目录与Apache以外的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目的设置,我试图从一个临时文件夹访问服务器上的文件。

I have a project setup and i'm trying to access a file from a temp folder on the server.

的文档根目录的网站是类似这样的:

The document root for the website is similar to this:

/a/b/c/d/e/f/g/h/mywebsite.com(的字母有适当的名称)。

/a/b/c/d/e/f/g/h/mywebsite.com (of the letters have proper names).

该文件,我需要读到这里的生活:

The file I need to read lives here:

/a/b/c/myfile.txt

/a/b/c/myfile.txt

我试过的符号链接,但可能已经做了他们是错的...任何想法?

I've tried symbolic links but may have done them wrong... any ideas?

推荐答案

您可以创建一个目录别名:

You can create a directory alias:

<VirtualHost....>

..... stuff .....

Alias /mydir /a/b/c

</VirtualHost>

,那么你可以访问文本文件,像这样:

then you could access the text file like so:

domain.com/mydir/myfile.txt

请注意,这需要发生中央配置文件中,而不是一个的.htaccess 文件。

Note that this needs to take place in the central configuration file, not a .htaccess file.

符号链接是一种选择了。请确保您有

Symlinks are an option too. Make sure you have

Options +FollowSymlinks

打开。

这篇关于访问文档根目录与Apache以外的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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