I'm wondering if anyone has had any experience with the php virtual() function. I was able to request in image from a php file without worrying about mime-type like this:
- Code: Select all
$file = "search.png";
$file_info = apache_lookup_uri($file);
header('content-type: ' . $file_info -> content_type);
virtual($file);
Of course, when I redirect all requests, this subrequest is being redirected as well. I'm sure there's a reasonably easy way around this, but is this method problematic in any way? Does it cause too much overhead? This would allow me to quickly skip all sorts of weirdness if it is practical.
Thanks
Edit:
The NS flag took care of subrequests, so it seems that this is all that is needed:
- Code: Select all
RewriteRule ^(.*)$ index.php [QSA,L,NC,NS]
Edit 2:
Well hell, once I've got the mime-type I realize I can just call readfile(), so now we're only making one request from apache with apache_lookup_uri(), surely this has got to be okay!?!?