RewriteEngine叙述和XSendFile之间Confilict [英] Confilict between RewriteEngine and XSendFile

查看:266
本文介绍了RewriteEngine叙述和XSendFile之间Confilict的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的PHP code

  $文件名='a56.flv';
$文件=C:/xampp/htdocs/site/flv/a56.flv;
标题(内容类型:应用程序/强制下载);
标题(内容类型:视频/ X-FLV');
标题(内容处置:附件;文件名='和addslashes($文件名)。');
//标题(内容类型:应用程序/八位字节流);
标题(内容类型:应用程序/下载;字符集= UTF-8);
标题(内容描述:文件传输);
标题(X-SENDFILE:$文件);
 

当我直接调用脚本(HTTP://localhost/site/get2.php FTYPE = FLV和放大器;文件名= a56.flv?),它工作正常,但只要与调用(HTTP://本地主机/网站/ vsrc_a56.flv)返回404页,这Apache的错误:

  [太阳1月15日2时01分44秒2012] [错误] [客户127.0.0.1](20024)给出的路径是misformatted或包含无效字符:xsendfile:无法找到文件:FLV / a56.flv
 

在哪里我的.htaccess文件就像如下:

  IndexIgnore的.htaccess * /。?? *〜*#* / HEADER * * / README * * / _ VTI *
AddDefaultCharset UTF-8
#########的ErrorDocument 404
ErrorDocument的404 /site/404.php
RewriteEngine叙述上
XSendFile上
重写规则^ _ VSRC(。*)$ ./get2.php?ftype=flv&filename=$1 [L]
 

解决方案

尝试添加的RewriteBase /网站/ 重写规则之前

I have following PHP code

$filename = 'a56.flv';
$file = "C:/xampp/htdocs/site/flv/a56.flv";
header("Content-Type: application/force-download");
header('Content-Type: video/x-flv');
header('Content-Disposition: attachment; filename="' . addslashes($filename) . '"');
//header("Content-Type: application/octet-stream");
header("Content-Type: application/download; charset=UTF-8");
header("Content-Description: File Transfer");
header("X-Sendfile: $file");

When I am calling script directly (http://localhost/site/get2.php?ftype=flv&filename=a56.flv) it works fine but as soon as calling with (http://localhost/site/vsrc_a56.flv) it returns 404 page and this apache error:

[Sun Jan 15 02:01:44 2012] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: xsendfile: unable to find file: flv/a56.flv

Where my .htaccess file is like as below:

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
AddDefaultCharset UTF-8
#########ErrorDocument 404 
ErrorDocument 404 /site/404.php
RewriteEngine On
XSendFile on
RewriteRule ^vsrc_(.*)$  ./get2.php?ftype=flv&filename=$1 [L]

解决方案

Try adding RewriteBase /site/ before RewriteRule

这篇关于RewriteEngine叙述和XSendFile之间Confilict的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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