Accessing files outside the document root with Apache

删除回忆录丶 提交于 2019-11-28 03:20:20

问题


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 (of the letters have proper names).

The file I need to read lives here:

/a/b/c/myfile.txt

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


回答1:


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

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

turned on.



来源:https://stackoverflow.com/questions/5570085/accessing-files-outside-the-document-root-with-apache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!