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!