logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: X-Sendfile with Mod-Rewrite (NEW: With Downloadable Example)
Author
Thog



Joined: 12 Feb 2007
Posts: 75
Location: Montreal

PostPosted: Sat 27 Aug '11 21:29    Post subject: X-Sendfile with Mod-Rewrite (NEW: With Downloadable Example) Reply with quote

If I use X-Sendfile with a static php page it works...

Code:

   header('Content-Type: image/jpeg');
   header('Content-Disposition: inline; filename="lala.jpg"');
   if (in_array('mod_xsendfile', apache_get_modules()))
   {
      header("X-Sendfile: data/images/00010001/00010002O.jpg");
   }


http://www.domain.com/z.php will display the right file...


If I use X-Sendfile with mod-rewrite it does not work...

Code:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?rave=$1 [QSA,L]
</IfModule>
XSendFile on


http://www.domain.com/ will work...

http://www.domain.com/z/ will show...

Not Found

The requested URL /index.php was not found on this server.

---

Any idea how to fix this...

DOWNLOAD TEST CODE: http://lofts.rave.ca/test.rar
PUT THE CODE IN YOUR ROOT DIRECTORY...

if you run...

http://www.domain.com/ it will work...

if you run...

http://www.domain.com/z/ it will not work...
Back to top
Thog



Joined: 12 Feb 2007
Posts: 75
Location: Montreal

PostPosted: Tue 30 Aug '11 23:49    Post subject: Reply with quote

Anyone have a possible answer!
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3056
Location: Hilversum, NL, EU

PostPosted: Wed 31 Aug '11 10:48    Post subject: Reply with quote

X-sendfile is not so commonly used.

I asked the Author to look at this post.

Steffen
Back to top
Thog



Joined: 12 Feb 2007
Posts: 75
Location: Montreal

PostPosted: Thu 08 Sep '11 23:22    Post subject: Reply with quote

Thanks! It is actually very usefull... Especially if you have a lot of images which php processes and you just want apache to dump the file via PHP!
Back to top


Reply to topic   Topic: X-Sendfile with Mod-Rewrite (NEW: With Downloadable Example) View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules