homepage Welcome to WebmasterWorld Guest from 54.211.235.255
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
request? what request?
lucy24




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

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?

 

Dideved




msg:4568780
 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved