IIRF not recognizing filenames or directories !-f !-d

Topics: User Forum
Jan 24, 2012 at 4:39 PM

Hi,

I have been using IIRF for a while now and it's great, but a problem I have always had (and just never managed to fix) was the ability to detect existing files or directories and therefore ignore the rule.

My ini looks like this:

RewriteLog C:\Inetpub\iirfLogs\iirf
RewriteLogLevel 4

RewriteEngine ON
StatusInquiry ON

#Check if the requested URL is a file / directory
RewriteCond %{REQUEST_FILENAME}     !-f 
RewriteCond %{REQUEST_FILENAME}     !-d 
RewriteCond %{REQUEST_FILENAME}     !-s 
RewriteRule ^/(.*)$ /index.php?$1 [L]

If I then try to access a file I know to be on the server it comes back as true and executes the rule (when it should be ignoring it) the log I get from this looks like this:

Tue Jan 24 16:11:49 - 72132 - IsIniChainUpdated: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini NO
Tue Jan 24 16:11:49 - 72132 - IsIniChainUpdated: return FALSE
Tue Jan 24 16:11:49 - 72132 - IsIniChainUpdated: return FALSE
Tue Jan 24 16:11:49 - 72132 - GetVdirConfig: Obtain  vdir '/LM/W3SVC/16455/Root' (era=3) (rc=1) (Expired=0) (ptr=0x099531F0)...
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Tue Jan 24 16:11:49 - 72132 - DoRewrites
Tue Jan 24 16:11:49 - 72132 - GetHeader_AutoFree: 'url' = '/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - GetHeader_AutoFree: 'method' = 'GET'
Tue Jan 24 16:11:49 - 72132 - DoRewrites: New Url, before decoding: '/requirements/index.php' 
Tue Jan 24 16:11:49 - 72132 - DoRewrites: Url (decoded): '/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: depth=0
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: no RewriteBase
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: Rule 1: pattern: ^/(.*)$  subject: /requirements/index.php
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: Rule 1: 2 match
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: Rule 1: evaluating condition
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: alloc 24 bytes
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: in='%{HTTP_URL}' out='/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: alloc 25 bytes
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: in '/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: out '/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: result '/requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Cond t(%{HTTP_URL}) op(~) p((/|\.htm|\.php|\.html|/[^.]*)$) => TRUE
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: alloc 66 bytes
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: alloc 67 bytes
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: in 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: out 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: cond->SpecialConditionType= 'f'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Special variant, retVal= false
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(f) p(!-f) => TRUE
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: alloc 66 bytes
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: alloc 67 bytes
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: in 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: out 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: cond->SpecialConditionType= 'd'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Special variant, retVal= false
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(d) p(!-d) => TRUE
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: alloc 66 bytes
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: alloc 67 bytes
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: in 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: out 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\requirements\index.php'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: cond->SpecialConditionType= 's'
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Special variant, retVal= false
Tue Jan 24 16:11:49 - 72132 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(s) p(!-s) => TRUE
Tue Jan 24 16:11:49 - 72132 - EvalConditionList: rule 1, TRUE, Rule will apply
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: alloc 14 bytes
Tue Jan 24 16:11:49 - 72132 - ReplaceServerVariables: in='/index.php?$1' out='/index.php?$1'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: alloc 35 bytes
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: in '/index.php?requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - ApplyUrlEncoding: out '/index.php?requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - GenerateReplacementString: result '/index.php?requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: Result (length 33): /index.php?requirements/index.php
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: Last Rule
Tue Jan 24 16:11:49 - 72132 - EvaluateRules: returning 1
Tue Jan 24 16:11:49 - 72132 - DoRewrites: Rewrite Url to: '/index.php?requirements/index.php'
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Jan 24 16:11:49 - 72132 - HttpFilterProc: cfg= 0x099531F0
Tue Jan 24 16:11:49 - 72132 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/16455/Root' (era=3) (rc=0) (Expired=0) (ptr=0x099531F0)...

The path it is trying to check for the file is correct, but for some reason the rule still returns TRUE

I have managed to work around this by using the following line:

RewriteCond %{REQUEST_FILENAME}  !\.+(xml|html|png|gif|jpg|swf|css|js|htm|txt|php|ico|pdf|doc)$ [I]

but unless i specify the file extension in the list it tries to rewrite the URL

I have updated to the latest version of IIRF just incase I missed some bug report but still no joy. The iirfStatus reports no problems and with the workaround the ini does work but it would be better if the -f and -d worked

I am using IIS6.0 and the 32bit version of IIRF

I hope all this makes sense and any pointers would be great! If you need any more information please let me know.

Cheers

Richard