xsendfile不会与mod_rewrite的工作 [英] xsendfile won't work with mod_rewrite

查看:238
本文介绍了xsendfile不会与mod_rewrite的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个重写URL发送文件。
里面的.htaccess文件我有:

I'm trying to send file from a rewritten URL. Inside the .htaccess file I have:

RewriteRule ^foo$ foo.php [L]

在foo.php:

header("x-sendfile: ".$_SERVER["DOCUMENT_ROOT"]."/filesdir/test.txt");

当浏览到直接foo.php我看到文件的内容,但浏览到/富时,我得到404

When browsing to foo.php directly I see the content of the file, but when browsing to /foo I get 404.

我试着在网上搜索,但无法找到此之外的任何解决方案不是重定向到富foo.php

I've tried to search the web but couldn't find any solution for this other than redirecting foo to foo.php

有谁知道有什么问题,该如何解决呢?

does anyone knows what's the problem and how to solve it?

推荐答案

我解决了这个问题。

在httpd.conf中有哪些是同时在PHP中会出现FILESDIR实际上是一个符号链接到XSendFilePath路径解析的符号路径XSendFilePath指令。

In httpd.conf there was XSendFilePath directive which was a resolved symbol path while in the php there the "filesdir" was actually a symbolic link to the path in XSendFilePath.

我已经添加symoblic链接XSendFilePath,现在一切正常!

I've add the symoblic link to XSendFilePath and now everything works well!

这篇关于xsendfile不会与mod_rewrite的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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