Confilict between RewriteEngine and XSendFile

1.7k views Asked by At

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]
1

There are 1 answers

1
Vyktor On BEST ANSWER

Try adding RewriteBase /site/ before RewriteRule