Detecting if files/directories exist

Topics: Developer Forum
Mar 8, 2012 at 12:45 AM

I'm migrating a slew of sites from a server using an older version of IIRF and cannot for the life of me debug why the rules won't work on the latest version of IIRF (on my new server).

What I'm trying to do is check to make sure the requested file/directory exists and if NOT, something.  What's wrong with my syntax?

# If the directory doesn't exist
RewriteCond %{REQUEST_FILENAME} !-d

# If the file doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f

# Do something

Mar 8, 2012 at 12:52 AM

I'm using:

Ionic ISAPI Rewriting Filter (IIRF) x64 RELEASE

Mar 13, 2012 at 1:09 AM

it looks right to me, but then, you've shown only a fragment.

The most helpful tool in diagnosing this sort of thing is the logfile generated by IIRF when you turn logging on.

use log level of 3 or so, to get some insight.

Run one request through the filter, and see what the logfile says.


you mentioned that you are moving from an older version of IIRF. The  v1.2 and the v2.0 version of IIRF use different ini files, in different locations. That may be the source of your problem.  Check the documentation for full details.