REQUEST_FILENAME not processing correctly for actual files/directories

Topics: User Forum
Aug 3, 2010 at 10:57 PM

Hi,

I finally got IIRF working but when I load a page every URL on the code is being rewritten. I am using the following Iirf.ini

RewriteLog C:\Inetpub\iirfLogs\iirf
RewriteLogLevel 5

RewriteEngine ON
StatusInquiry ON RemoteOK

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^/(.*)$ /index.php?/$1 [L]

and it loads the pages fine, but any images, css etc. are not loading as it's applying the rules to those items as well :(

I thought it would only apply this to the URL and not items called within the web page, but PLEASE any help on this one would be great....i'm slo close :P

Cheers

Richard

Aug 3, 2010 at 11:21 PM

Looking at the logs it seems that it is not evaluating the paths as files etc. It returns with 'It is not a file' or 'it is not a directory' when clearly the file exists.

The paths in the log that it is querying seem fine and if I paste them into explorer the image etc. appears fine. Below is a chunk of the log:

IsIniFileUpdated: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini YES
Wed Aug 04 00:15:16 -  5520 - GetVdirConfig: Obtain  vdir '/LM/W3SVC/16455/Root' , Ini file has been updated.
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: actual log file 'C:\Inetpub\iirfLogs\iirf.8248.log'
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: ini file: 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini'
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: ini file timestamp: 2010/08/04 00:15:06 GMT Daylight Time
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: cfg(0x01884D30)
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: LogLevel = 5
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: pass 2
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(4): RewriteEngine will be enabled.
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(5): StatusInquiry ON RemoteOK (--)
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(5): IIRF Status Inquiry is enabled at path '/iirfStatus' for local or remote requests.
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(7): RewriteCond   %{REQUEST_FILENAME}  !-f '(null)'
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(8): RewriteCond   %{REQUEST_FILENAME}  !-d '(null)'
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(9): RewriteCond   %{REQUEST_FILENAME}  !-s '(null)'
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\Iirf.ini(10): RewriteRule (rule 1)  '^/(.*)$'  '/index.php?/$1'      [L]
Wed Aug 04 00:15:16 -  5520 - ParseRuleModifierFlags: '[L]'
Wed Aug 04 00:15:16 -  5520 - ParseRuleModifierFlags: token 'L'
Wed Aug 04 00:15:16 -  5520 - rule: Last
Wed Aug 04 00:15:16 -  5520 - ReadVdirConfig: Done reading INI for the root vdir, found 1 rules (0 errors, 0 warnings) on 11 lines
Wed Aug 04 00:15:16 -  5520 - ReleaseOrExpireVdirConfig: vdir '/LM/W3SVC/16455/Root' (era=1) (rc=0) (Expired=1) (ptr=0x01886510)...
Wed Aug 04 00:15:16 -  5520 - GetVdirConfig: Obtain  vdir '/LM/W3SVC/16455/Root' (era=2) (rc=1) (Expired=0) (ptr=0x01884D30)...
Wed Aug 04 00:15:16 -  5520 - HttpFilterProc: SF_NOTIFY_URL_MAP
Wed Aug 04 00:15:16 -  5520 - HttpFilterProc: cfg= 0x01884D30
Wed Aug 04 00:15:16 -  5520 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Wed Aug 04 00:15:16 -  5520 - DoRewrites
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: getting 'url'
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: 24 bytes   ptr:0x001A32E0
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: 'url' = '/images/layout/logo.gif'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable_AutoFree: getting 'QUERY_STRING'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable_AutoFree: 1 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable_AutoFree: result ''
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: getting 'method'
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: 4 bytes   ptr:0x0019F930
Wed Aug 04 00:15:16 -  5520 - GetHeader_AutoFree: 'method' = 'GET'
Wed Aug 04 00:15:16 -  5520 - DoRewrites: New Url, before decoding: '/images/layout/logo.gif'
Wed Aug 04 00:15:16 -  5520 - DoRewrites: Url (no decoding): '/images/layout/logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: depth=0
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'SCRIPT_NAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 24 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result '/images/layout/logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: no RewriteBase
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: Rule 1: pattern: ^/(.*)$  subject: /images/layout/logo.gif
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: Rule 1: 2 match
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: Rule 1: evaluating condition
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond 0x01884B88
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: alloc 83 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: vName(REQUEST_FILENAME) value(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif)
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: ts1 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: alloc 73 bytes
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: t(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif) op(f) p(!-f)
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond->SpecialConditionType= 'f'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Special: it is not a file
Wed Aug 04 00:15:16 -  5520 - EvalCondition: File variant, retVal= false
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(f) p(!-f) => TRUE
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Child is non NULL (parent= 0x01884B88) (child= 0x018865B8)
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Current condition evaluates to TRUE
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Logical AND, ergo we evaluate the Child
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond 0x018865B8
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: alloc 83 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: vName(REQUEST_FILENAME) value(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif)
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: ts1 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: alloc 73 bytes
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: t(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif) op(d) p(!-d)
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond->SpecialConditionType= 'd'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Special: it is not a directory
Wed Aug 04 00:15:16 -  5520 - EvalCondition: File variant, retVal= false
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(d) p(!-d) => TRUE
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Child is non NULL (parent= 0x018865B8) (child= 0x01883FE8)
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Current condition evaluates to TRUE
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Logical AND, ergo we evaluate the Child
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond 0x01883FE8
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: alloc 83 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: getting 'REQUEST_FILENAME'
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: special variable name
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: 65 bytes
Wed Aug 04 00:15:16 -  5520 - GetServerVariable: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: vName(REQUEST_FILENAME) value(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif)
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: in='%{REQUEST_FILENAME}' out='C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: ts1 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: alloc 73 bytes
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: result 'C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: t(C:\Inetpub\vhosts\dickwalsh.co.uk\httpdocs\images\layout\logo.gif) op(s) p(!-s)
Wed Aug 04 00:15:16 -  5520 - EvalCondition: cond->SpecialConditionType= 's'
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Special: it is not a file
Wed Aug 04 00:15:16 -  5520 - EvalCondition: File variant, retVal= false
Wed Aug 04 00:15:16 -  5520 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(s) p(!-s) => TRUE
Wed Aug 04 00:15:16 -  5520 - EvalConditionList: rule 1, TRUE, Rule will apply
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: alloc 15 bytes
Wed Aug 04 00:15:16 -  5520 - ReplaceServerVariables: in='/index.php?/$1' out='/index.php?/$1'
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: alloc 42 bytes
Wed Aug 04 00:15:16 -  5520 - GenerateReplacementString: result '/index.php?/images/layout/logo.gif'
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: Result (length 34): /index.php?/images/layout/logo.gif
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: Last Rule
Wed Aug 04 00:15:16 -  5520 - EvaluateRules: returning 1
Wed Aug 04 00:15:16 -  5520 - DoRewrites: Rewrite Url to: '/index.php?/images/layout/logo.gif'

Hope that helps someone to spot the issue.

Cheers

Richard

Aug 4, 2010 at 11:30 AM
Hi,

Just keeping this going, hopefully someone will be able to shed some light on this or perhaps it will help others in a similar pickle.
Anyway, I have managed to get my site working by forgetting about the -f -d -s tags. However, I would really have preferred to use them so if you know why they are not resolving files as files then I would love to know. I read another thread on this issue so perhaps it's an old bug that has resurfaced...anyway my ini looks like this now:

RewriteLog C:\Inetpub\iirfLogs\iirf
RewriteLogLevel 1

RewriteEngine ON
StatusInquiry ON

RewriteCond %{REQUEST_FILENAME} !\.+(xml|html|png|gif|jpg|swf|css|js|htm|txt|php)$
RewriteRule ^/(.*)$ /index.php?$1 [L]

And so far so good. But if the -f -d -s tags worked it would be a lot more robust so of anyone can answer that query I would be grateful.

Cheers
Richard

Aug 5, 2010 at 7:29 PM

Hi,

Well I guess my fix was not as flawless as I had hoped. I tried created an IIrf.ini inside another directory and it is not being read. When looking at the logs it looks like it is still reading the Iirf.ini in the root folder. So basically it's not recognising the sub folder as a folder. I have added the REQUEST_FILENAME lines back into the iirf just to see if it helped but no joy :(

I have no idea why it is not recognising folders and files etc. but it refuses to acknowledge that they exist and rewrites everything.

If anyone can shed some light on this I would be very grateful.

Thanks!

Richard

Coordinator
Aug 10, 2010 at 11:30 AM
The answers to your questions are in the documentation. First, ALL urls are processed by the iirf engine, not only urls that you see in the browser address bar. Second, config is not read in on a per-directory basis. Iirf reads a config file for each vdir or application. As for what is happening with the -f flag , I don't know, but suggest you investigate further , simplify, and above all read the documentation. Good luck.
Aug 11, 2010 at 6:31 AM
freakrhw wrote:

Hi,

Well I guess my fix was not as flawless as I had hoped. I tried created an IIrf.ini inside another directory and it is not being read. When looking at the logs it looks like it is still reading the Iirf.ini in the root folder. So basically it's not recognising the sub folder as a folder. I have added the REQUEST_FILENAME lines back into the iirf just to see if it helped but no joy :(

I have no idea why it is not recognising folders and files etc. but it refuses to acknowledge that they exist and rewrites everything.

If anyone can shed some light on this I would be very grateful.

Thanks!

Richard

Richard,

Are you adding

IncludeIni D:\Path\iirf.ini

directives to your top level iirf.ini file? - Also, did you call the http://localhost/iirfstatus page to see if you are running into any obvious errors? This is a great source for information. Make sure your RewriteLogLevel is set to 5 (as seen at the very top) and study the output.

Further, have you tested

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{REQUEST_FILENAME} !-l [NC]

Just a few thoughts here. Also, if you were to post your intentions, others wouldn't have to reverse engineer your code trying to figure out of what it is you are trying to accomplish.

Hope you are getting things resolved.

Sep 2, 2010 at 1:58 PM

A doable solution would be to put all your files that needs to be reached without url rewrite in a folder, let's call it "files". Then you can do something like:

RewriteRule ^/(?!files)(.+)$ /index.php?$1 [L]