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 Wed, 10 Sep 2008 16:39:12 GMT

On Sep 10, 2008, at 12:36 PM, Justin Pasher wrote:

> Jason Pruim wrote:
>> Hello everyone,
>>
>> So I'm still fighting with mod_rewrite a little but I have made  
>> progress... Basically, what I am looking to do now, is check to see  
>> if a file/folder exists and if not rewrite and give control to my  
>> p.php script to look it up in the database.
>>
>> Here are the rules that I'm using:
>>
>>        RewriteCond %{REQUEST_FILENAME} !-f
>>                RewriteCond %{REQUEST_FILENAME} !-d
>>                RewriteRule . /p.php [L]
>>
>> Now, that part works just fine, but what I can't seem to work out  
>> is the sublinks. I have some links that look like this: HTTP://purl.schreurprinting.com/mail.php?purl=jasonpruim112

>>  Now mail.php exists and so it should NOT be rewriting, but it  
>> is... Basically... If someone goes to mail.php?purl=jasonpruim112 I  
>> want mail.php to handle the request... Am I making sense?
>>
>> Anyone have any clue what I need to do?
>>
>> Thanks for looking!
>
> I threw together a quick test with the same rewrite rules you  
> mentioned above and it seems to work properly for me. Are these  
> rules defined in an .htaccess file or the apache config? I know that  
> rewrite rules can act a little differently between the two  
> locations. Are there any other rewrite rules being invoked? Can you  
> turn on the rewrite logging to see exactly what mod_rewrite is doing?
>
> RewriteLogLevel 3
> RewriteLog /path/to/rewrite.log
Hey Justin,

Thanks for the reply.

The rules are being applied from a virtual host config, so as high up  
the chain as it can go.

And since I was running into issues, I set the rewrite log up to 9 and  
here is the output that I just got from it:

BEGIN LOG

192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2) init  
rewrite engine with requested uri /purl/mail.php
192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (3)  
applying pattern '.' to uri '/purl/mail.php'
192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
RewriteCond: input='/purl/mail.php' pattern='!-f' => matched
192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
RewriteCond: input='/purl/mail.php' pattern='!-d' => matched
192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
rewrite /purl/mail.php -> /p.php
192.168.0.253 - - [10/Sep/2008:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2) local  
path result: /p.php
192.168.0.253 - - [10/Sep/2008:12:38:10 -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:12:38:10 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (1) go- 
ahead with /Volumes/RAIDer/webserver/purl.schreurprinting.com/p.php [OK]
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2) init  
rewrite engine with requested uri /favicon.ico
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (3)  
applying pattern '.' to uri '/favicon.ico'
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
RewriteCond: input='/favicon.ico' pattern='!-f' => matched
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (4)  
RewriteCond: input='/favicon.ico' pattern='!-d' => matched
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2)  
rewrite /favicon.ico -> /p.php
192.168.0.253 - - [10/Sep/2008:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (2) local  
path result: /p.php
192.168.0.253 - - [10/Sep/2008:12:38:11 -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:12:38:11 -0400]  
[purl.schreurprinting.com/sid#183ecd8][rid#1836238/initial] (1) go- 
ahead with /Volumes/RAIDer/webserver/purl.schreurprinting.com/p.php [OK]




And no, there are no other rules being used that I am aware of.

--

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