访问文档根范围之外的文件
我正在编写一个脚本来构建一个动态网站, 该网站是通过加载外部组件创建的。
DocumentRoot 位于 /sites/website/public 组件目录位于 /sites/website/components
我想根据请求的 url 到达每个组件的数据目录。
例如:
网址:
http://ibuildmywebsite/component-data/randomimage/demo/ swan04090044_small.jpg
应该获取文件 /sites/website/components/randomimage/data/demo/swan04090044_small.jpg
我怎样才能实现这一点? 我更喜欢一种可以放置在 .htaccess (如果有的话)内部的方法,而不是修改虚拟主机定义。
谢谢!
I'm writing a script to build a dynamic website,
the website is created by loading external components.
The DocumentRoot is location at /sites/website/public
the components directory is located at /sites/website/components
i wannna reach the data directory of each component depends on the requested url.
for example:
the url:
http://ibuildmywebsite/component-data/randomimage/demo/swan04090044_small.jpg
should fetch the file /sites/website/components/randomimage/data/demo/swan04090044_small.jpg
how can i achieve that ?
i would prefer a way that can be placed inside .htaccess (if there is one) instead of modifying the virtual host definitions.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许将 RewriteRule 与 Alias 结合起来?
(虽然在 .htaccess 中不起作用)
您也可以使用符号链接:
并将
components-*/randommimage/*
动态链接到/sites/website/components/randomimage/*/ */
Combine RewriteRule with Alias maybe ?
(Won't work in .htaccess though)
You could probably also use Symlinks with:
And link dynamically
components-*/randommimage/*
to/sites/website/components/randomimage/*/*/