httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Pruim <japr...@raoset.com>
Subject Re: [users@httpd] Checking if file or directory exist
Date Thu, 11 Sep 2008 10:28:19 GMT

On Sep 10, 2008, at 2:21 PM, Justin Pasher wrote:

> Jason Pruim wrote:
>>
>> On Sep 10, 2008, at 1:38 PM, Justin Pasher wrote:
>>
>>> Jason Pruim wrote:
>>>> Actually it is... It was something that I tried to fix the  
>>>> problem. All the links refer to /mail.php though...
>>>>
>>>> BEGIN LOG
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>>>> init rewrite engine with requested uri /mail.php
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (3)  
>>>> applying pattern '.' to uri '/mail.php'
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
>>>> RewriteCond: input='/mail.php' pattern='!-f' => matched
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
>>>> RewriteCond: input='/mail.php' pattern='!-d' => matched
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>>>> rewrite /mail.php -> /p.php
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>>>> local path result: /p.php
>>>> 192.168.0.253 - - [10/Sep/2008:13:28:26 -0400]  
>>>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>>>> prefixed with document_root to /Volumes/RAIDer/webserver/ 
>>>> purl.schreurprinting.com/p.php
>>>>
>>>> Also here is my directory structure...
>>>>
>>>> qs:/etc/httpd/sites japruim$ ls /volumes/raider/webserver/ 
>>>> purl.schreurprinting.com
>>>> build <----Folder
>>>> design.php
>>>> inc
>>>> index.php
>>>> mail.php
>>>> p.php
>>>> php.ini.php
>>>> pictures
>>>> print.php
>>>> purl <----Folder
>>>> purl.php
>>>> purl.schreurprinting.com.xcodeproj <----Folder
>>>> purlprocess.php
>>>> qs:/etc/httpd/sites japruim$
>>>
>>> What does the rewrite log entry look like when you try to just  
>>> access http://purl.schreurprinting.com/mail.php (without the query  
>>> string)?
>>>
>>> I noticed that the input for the write rule is "/mail.php" (as  
>>> opposed to /volumes/raider/webserver/purl.schreurprinting.com/ 
>>> mail.php). Since that file really doesn't exist, it fails the file  
>>> test. This might be due to the differences in rewrite rules in the  
>>> apache config versus .htaccess. Do you have a RewriteBase set in  
>>> the config? It looks like %{REQUEST_FILENAME} is not being  
>>> evaluated to the full path of the file. I haven't had a chance to  
>>> test myself in a VirtualHost config setup.
>>
>>
>> Here is the log for just http://purl.scherurprinting.com/mail.php
>> BEGIN LOG
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>> init rewrite engine with requested uri /mail.php
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (3)  
>> applying pattern '.' to uri '/mail.php'
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
>> RewriteCond: input='/mail.php' pattern='!-f' => matched
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
>> RewriteCond: input='/mail.php' pattern='!-d' => matched
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>> rewrite /mail.php -> /p.php
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>> local path result: /p.php
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
>> prefixed with document_root to /Volumes/RAIDer/webserver/ 
>> purl.schreurprinting.com/p.php
>> 192.168.0.253 - - [10/Sep/2008:13:40:25 -0400]  
>> [purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (1) go- 
>> ahead with /Volumes/RAIDer/webserver/purl.schreurprinting.com/p.php  
>> [OK]
>>
>>
>> But /volumes/raider/webserver/purl.schreurprinting.com/mail.php is  
>> valid... that is the entire file system path... but it's there :)
>>
>> Would this be easier to setup in a .htaccess file?
>
> According to this log, the request to just http://purl.scherurprinting.com/mail.php 
>  is also being rewritten now...? Wasn't this one working before (in  
> the initial email)?
>
> I did a quick test inside a VirtualHost instead of .htaccess and,  
> sure enough, the %{REQUEST_FILENAME} became just "/mail.php". It  
> looks like Apache is stripping off the DocumentRoot from % 
> {REQUEST_FILENAME} when used in the apache config. Try moving the  
> rewrite settings to an .htaccess file and see what the log shows  
> (especially for the "input=" line). If it works, and it is a  
> feasible solution, I'd go that route. It also allows you to modify  
> the rewrite rules without forcing an apache reload.


That is odd.... I moved the rewrite rules to a .htaccess file and now  
the real links work right, but the false links don't go into my  
handeler script... in other words http://purl.schreurprinting.com/mail.php?purl=jasonpruim112

  works but http://purl.schreurprinting.com/jasonpruim112 does NOT...

Here is my .htaccess file... Does it look right?

Options +FollowSymlinks
RewriteEngine on
RewriteLog /var/log/purl.virt.rewrite.log
RewriteLogLevel 9

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /p.php [L]

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@raoset.com





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message