Welcome to WebmasterWorld Guest from 54.145.221.99

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

request? what request?

   
10:13 pm on Apr 28, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



I've got a nasty suspicion that
(a) this is not really an apache question but a php question
and
(b) if someone else asked the identical question, I'd see the answer in an instant.

In the .htaccess file that goes with the pseudo-server on my HD, I've got a couple of RewriteRules to bypass the analytics and logging that happen on the live sites. Things like

RewriteRule logheaders /boilerplate/locallogs.php [L]


rewriting to an empty file so I don't log myself. (Apart from the content of the htaccess, the local files are intended to be an exact replica of the real thing, so simply moving the logheaders.php file isn't an option. Besides, I'd then get spurious error logs instead.)

Turns out this works most of the time, but visits to certain directories still get logged, meaning that the rewrite isn't taking place, meaning in turn that the request is somehow not getting seen by htaccess.

:: skipping over detailed description of steps involved in investigation ::

Turns out the variable is how the logheaders.php file gets included in the first place. If it's in the form

<!--#include virtual="/boilerplate/logheaders.php" -->


all is well. If, instead, it's in the form

include ($_SERVER['DOCUMENT_ROOT'] . "/boilerplate/logheaders.php");


the rewrite does not take place.

What gives? How does php contrive to get hold of a file without Apache noticing? And, probably more important: Is this an artifact of MAMP, or would exactly the same thing happen on the live site?
12:13 am on Apr 29, 2013 (gmt 0)



It would seem that SSI includes are treated as an internal sub-request, and therefore subject to rewrite rules. PHP includes, on the other hand, are not. So I suppose that if you absolutely must rely on rewrite rules to alter the included file, then you have to stick to SSI.