Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: X-Sendfile with Mod-Rewrite (NEW: With Downloadable Example) |
|
Author |
|
Thog
Joined: 12 Feb 2007 Posts: 75 Location: Montreal
|
Posted: Sat 27 Aug '11 21:29 Post subject: X-Sendfile with Mod-Rewrite (NEW: With Downloadable Example) |
|
|
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
|
Posted: Tue 30 Aug '11 23:49 Post subject: |
|
|
Anyone have a possible answer! |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Wed 31 Aug '11 10:48 Post subject: |
|
|
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
|
Posted: Thu 08 Sep '11 23:22 Post subject: |
|
|
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 |
|
|
|
|
|
|