clean url mod_rewrite causes problems with missing url

New to mod_rewrite? This is a good place to start.

clean url mod_rewrite causes problems with missing url

Postby darcy » Mon Aug 09, 2004 6:51 pm

hi,

i'm working on a system which implements clean urls (virtual directories which are resolved to a system of passing the path to a single script for the whole site). here's the code i have:

RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?p=$1 [L,QSA,S]

it works quite well. in fact too well. i'm now hitting a problem where if anywhere in my code, i request an image which doesn't exist, it too is caught by the rule. i've tried adding this condition:

RewriteCond %{REQUEST_FILENAME} !.gif$

this works if the image i am requesting is within a directory which exists. however, if the missing image is within a directory which doesn't exist, it does not match. Actually, here's where i'm a little unsure about how mod_rewrite works. i think what is happening is that mod_rewrite is passing over the image, but choking on the missing directory. is there any way to construct some mod_rewrite rules which will let me catch missing images and then completely bipass any further processing of that url request. by the way, i assumed that the [L] would do that...

i appreciate any suggestions...
darcy
 
Posts: 1
Joined: Mon Aug 09, 2004 6:39 pm

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 37 guests

cron