problem with Relative Url

Feb 4, 2011 at 6:05 PM

Hi, I'm using a simple rules for an old ASP.NET site, here my iirf.ini:

RewriteLog c:\inetpub\iirfLogs\iirf
RewriteLogLevel 3
RewriteEngine ON
StatusInquiry ON
IterationLimit 5
 
# DON'T rewrite for static asp.net files
RewriteRule ^App_Themes/(.*)$   -        [L]
RewriteRule ^/App_Themes/(.*)$   -        [L]
RewriteRule ^/Scripts/(.*)$   -        [L]
 
RewriteRule ^/category/(.*)$  /Category.aspx?idFnc=$1 [I,U]
RewriteRule ^/category/content/(.*)/(.*)$  /CatContent.aspx?idCat=$1&idFnc=$2 [I,U]

If i call the site to test the new rule, like: http://mysite/category/10

iirf rewrite the url correctly, but I have problems with resources that have a relative url, i.e. if the page renders an image with src='App_Themes/default/logo.png' that is not rendered, 

instead if I change the src attribute to  src='/App_Themes/default/logo.png' all works.

The problem is that in tons of server controls I must use the "~/App_Themes/" prefix to all static resources, and that is covnerted to a relative path, without the root "/"...

How can I change the rules to match this ASP.NET behavior?

Hope to have explained well ;)

Coordinator
Feb 5, 2011 at 2:50 AM

Your idea is right - with those rules to "do nothing" when App_Themes is part of the URL. But your regex is too restrictive. Why not just use App_Themes anywhere in the URL?

# Don't rewrite if it is a static file
RewriteRule App_Themes    - [L]

Notice there is no ^ at the beginning of the pattern.  the ^ indicates "beginning-of-line" , but you don't want the rule to match only when the URL *begins with* App_Themes, right?  You want the "do nothing" rule to match when App_Themes is anywhere in the URL.  I think.  I don't know if this will work, but it's closer than what you;ve got. 

For more insight, check the IIRF log file and you can see what the incoming URLs look like, and what they are being rewritten to.

good luck.

 

Feb 5, 2011 at 2:52 PM

Hi Cheeso, thanks for the reply.

I tried the modified rule you wrote, but still U have problems with the requests for images under the the /App_Themes folder. Here us the iirf log:

 

Fri Feb 04 16:44:07 -  7464 - DoRewrites: Rewrite Url to: '/Category.aspx?idFnc=App_Themes/Default/Images/banner_categoria.jpg'
Fri Feb 04 16:44:07 -  7464 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  7464 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  5924 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/back_h.jpg'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 37): /App_Themes/Default/Images/back_h.jpg
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/back_h.jpg'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/cart_img.gif'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 39): /App_Themes/Default/Images/cart_img.gif
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/cart_img.gif'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/inp_Search.png'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 41): /App_Themes/Default/Images/inp_Search.png
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/inp_Search.png'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/res_back.gif'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 39): /App_Themes/Default/Images/res_back.gif
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/res_back.gif'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/back_foto.png'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 40): /App_Themes/Default/Images/back_foto.png
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/back_foto.png'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/big_char.gif'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 39): /App_Themes/Default/Images/big_char.gif
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/big_char.gif'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:07 -  8316 - DoRewrites
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/small_char.gif'
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Result (length 41): /App_Themes/Default/Images/small_char.gif
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:07 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:07 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/small_char.gif'
Fri Feb 04 16:44:07 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:08 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:08 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:08 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:08 -  8316 - DoRewrites
Fri Feb 04 16:44:08 -  8316 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/bg_footer.jpg'
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: Rule 3: 2 matches
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: Result (length 40): /App_Themes/Default/Images/bg_footer.jpg
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: Last Rule
Fri Feb 04 16:44:08 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:08 -  8316 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/bg_footer.jpg'
Fri Feb 04 16:44:08 -  8316 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:09 -  8316 - DoRewrites
Fri Feb 04 16:44:09 -  8316 - DoRewrites: Url (no decoding): '/category/loading.gif'
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 3: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 4: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 5: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 6: 2 matches
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Result (length 32): /Category.aspx?idFnc=loading.gif
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: depth=1
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 3: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 4: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 5: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 6: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 7: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: returning 0
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:09 -  8316 - DoRewrites: Rewrite Url to: '/Category.aspx?idFnc=loading.gif'
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:09 -  6260 - HttpFilterProc: SF_NOTIFY_LOG
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Fri Feb 04 16:44:09 -  8316 - DoRewrites
Fri Feb 04 16:44:09 -  8316 - DoRewrites: Url (no decoding): '/category/close.gif'
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: depth=0
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 3: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 4: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 5: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 6: 2 matches
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Result (length 30): /Category.aspx?idFnc=close.gif
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: depth=1
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: no RewriteBase
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 1: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 2: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 3: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 4: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 5: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 6: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: Rule 7: -1 (No match)
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: returning 0
Fri Feb 04 16:44:09 -  8316 - EvaluateRules: returning 1
Fri Feb 04 16:44:09 -  8316 - DoRewrites: Rewrite Url to: '/Category.aspx?idFnc=close.gif'
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: SF_NOTIFY_URL_MAP
Fri Feb 04 16:44:09 -  8316 - HttpFilterProc: cfg= 0x012357E0
Fri Feb 04 16:44:09 -  6260 - HttpFilterProc: SF_NOTIFY_LOG

 

As you can see, iirf does a wrong rewrite, i.e. /Category.aspx?idFnc=close.gif

that is strange, isn't it? somehow there is a conflict between two rules, the no match and the category rule....

Coordinator
Feb 5, 2011 at 9:46 PM

Well , the rule I suggested seems to be working VERY well - every URL with App_Themes in it is not rewritten, as you wanted.

I think now, you also want to NOT rewrite URLs that have .gif in them, maybe.  But I'm not sure.  If that's the case, just insert another pattern that matches on *.gif, and don't rewrite those, either.  (USe a replacement pattern of - ). 

This is the way to develop rules: you try a set of rules, test the set, tweak the rules, try again, etc.  You're getting there.

 

Feb 7, 2011 at 9:21 AM

Yes you are right, I want to esxlude the urlrewrite for all static files, scripts, css & images

Now my rule are these:

# DON'T rewrite for static asp.net files
RewriteRule App_Themes   -        [L]
RewriteRule Scripts   -        [L]
RewriteRule (.png)$   -        [L]
RewriteRule (.gif)$   -        [L]
RewriteRule (.jpg)$   -        [L]

RewriteRule ^/category/(.*)$  /Category.aspx?idFnc=$1 [I,U]
RewriteRule ^/category/content/(.*)/(.*)$  /CatContent.aspx?idCat=$1&idFnc=$2 [I,U]

and the log is:

Mon Feb 07 10:17:30 -  4740 - DoRewrites: Url (no decoding): '/category/545bba30-c498-453a-8b45-b1a218650142'
Mon Feb 07 10:17:30 -  4740 - DoRewrites: Rewrite Url to: '/Category.aspx?idFnc=545bba30-c498-453a-8b45-b1a218650142'
Mon Feb 07 10:18:01 -  3508 - DoRewrites: Url (no decoding): '/'
Mon Feb 07 10:18:01 -  3508 - DoRewrites: No Rewrite
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Url (no decoding): '/Scripts/marquee.js'
Mon Feb 07 10:18:06 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Rewrite Url to: '/Scripts/marquee.js'
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Url (no decoding): '/Scripts/marquee.js'
Mon Feb 07 10:18:06 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Rewrite Url to: '/Scripts/marquee.js'
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Url (no decoding): '/close.gif'
Mon Feb 07 10:18:06 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:06 -  4740 - DoRewrites: Rewrite Url to: '/close.gif'
Mon Feb 07 10:18:17 -  4740 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/image2.jpg'
Mon Feb 07 10:18:17 -  3508 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/loading.gif'
Mon Feb 07 10:18:17 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:17 -  3508 - EvaluateRules: Last Rule
Mon Feb 07 10:18:17 -  4740 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/image2.jpg'
Mon Feb 07 10:18:17 -  3508 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/loading.gif'
Mon Feb 07 10:18:27 -  4740 - DoRewrites: Url (no decoding): '/App_Themes/Default/Images/image3.jpg'
Mon Feb 07 10:18:27 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:27 -  4740 - DoRewrites: Rewrite Url to: '/App_Themes/Default/Images/image3.jpg'
Mon Feb 07 10:18:27 -  3508 - DoRewrites: Url (no decoding): '/category/545bba30-c498-453a-8b45-b1a218650142'
Mon Feb 07 10:18:27 -  3508 - DoRewrites: Rewrite Url to: '/Category.aspx?idFnc=545bba30-c498-453a-8b45-b1a218650142'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/box_catalogo.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/box_catalogo.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/box_premi.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/box_premi.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/banner_categoria.jpg'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/banner_categoria.jpg'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/Italia.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/Italia.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/inghilterra.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/inghilterra.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/francese.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/francese.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/giappone.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/giappone.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/box_catalogo.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/box_catalogo.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/box_premi.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/box_premi.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/btn_Search_2.png'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/btn_Search_2.png'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/App_Themes/Default/Images/banner_categoria.jpg'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/App_Themes/Default/Images/banner_categoria.jpg'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/loading.gif'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/loading.gif'
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Url (no decoding): '/category/close.gif'
Mon Feb 07 10:18:28 -  4740 - EvaluateRules: Last Rule
Mon Feb 07 10:18:28 -  4740 - DoRewrites: Rewrite Url to: '/category/close.gif'

As you see it acts oddly, it concatenate the "category" path with the real url: "/category/App_Themes/Default/Images/banner_categoria.jpg" is wrong, the real is "/App_Themes/Default/Images/banner_categoria.jpg"

?

Coordinator
Feb 10, 2011 at 2:02 PM

> As you see it acts oddly, it concatenate the "category" path with the real url: "/category/App_Themes/Default/Images/banner_categoria.jpg" is wrong

Ah, yes, I see.

But the messages in the IIRF log indicate that the incoming URL is wrong.  IIRF does not rewrite the URL that way.  It arrives that way.

This likely means that your HTML page includes the URL this way.  This can happen if you use relative URLs (eg, "~App_Themes/foo/bar/bam.jpg"), rather than absolute ones ("/App_Themes/fo/bar/bam.jpg")  .

There are two ways to fix it:  One is to make sure the HTML page in question generates proper URLs in the first place. This is the preferred mechanism. The second way is to rewrite from any URL that is broken back to the correct URL.  Do this with an additional URL in IIRF, like so:

RewriteUrl ^/category(/App_Themes.+)   $1  [L]

The above rule removes /category prefix from any URL that starts with /category/App_Themes .

Good luck.