1

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

RewriteRule ^foo$ foo.php [L]

In foo.php:

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

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

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?

Niros
  • 632
  • 5
  • 18

1 Answers1

0

I solved the problem.

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.

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

Niros
  • 632
  • 5
  • 18
  • 1
    I have got the same problem as you, but I am not sure if your solution could work in my case, too. As long as I use absolute paths generated by using getenv('document_root') they shouldn't use any symbolic links, do they? Or am I missing something at this point? Would you be so kind to have a look at my post,too? (http://stackoverflow.com/questions/20705731/mod-xsendfile-wont-work-with-cgi-and-mod-rewrite ) – Johnson_145 Dec 20 '13 at 16:00