help translating url

Topics: User Forum
Nov 10, 2009 at 3:20 PM
Edited Nov 10, 2009 at 3:38 PM

I could use some help translating a url.

I would like to change '/exec/action/customersearch/hspos/hsnet?pvs=backto.http%3a%2f%2fhopereview%2fexec%2fhspos%2fhsnet'

to '/default.aspx/action/customersearch/hspos/hsnet?pvs=backto.http%3a%2f%2fhopereview%2fexec%2fhspos%2fhsnet'

I am currently using this as my rule; RewriteRule /(exec|default.aspx)(/?)(\??)(.*)$ /default.aspx/$4 [I,L]

Here is the output I'm getting currently; '/default.aspx/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:'

I turned off UrlDecoding, is there a better solution?

Coordinator
Nov 10, 2009 at 3:56 PM

Dan,

your rule works for me.  If UrlDecoding is OFF, then I get the escaped string, exactly as you have it.  If UrlDecoding is ON (or not present in the ini file, which means ON), then I get an un-escaped string.  All the %3F characters, and so on, are replaced with their equivalent ASCII.

Now, I don't have a default.aspx that accepts that kind of input.  So I do get a 404.  (Also, I'm not sure how a path like /default.aspx/action/customersearch (etc etc) gets handed off to an ASPNET page.  What page does it hand off to? )   But from the IIRF logfile, I can see that the   result of the rewrite is what you think it ought to be.

How do you determine that the output you are getting is '/default.aspx/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:'   ??

Where do you see that output?

-Chees

Nov 10, 2009 at 4:07 PM

I see that output in the log file.

I would like to eventually change the action/customersearch to standard variables action=customersearch, but am currently just trying to replace an existing url rewriter.  The .net application is currently handling the / to = translation.

 

Tue Nov 10 10:04:19 -  5472 - -------------------------------------------------------
Tue Nov 10 10:04:19 -  5472 - Ionic ISAPI Rewriting Filter (IIRF) 2.0.1.1008 RELEASE
Tue Nov 10 10:04:19 -  5472 - IIRF was built on: Nov  9 2009 05:53:46
Tue Nov 10 10:04:19 -  5472 - Cached: DLL_PROCESS_ATTACH
Tue Nov 10 10:04:19 -  5472 - Cached: Process ID: 2432
Tue Nov 10 10:04:19 -  5472 - Cached: DLL_PROCESS_ATTACH - complete
Tue Nov 10 10:04:19 -  5472 - Cached: GetFilterVersion
Tue Nov 10 10:04:19 -  5472 - GetLogFile: app:'/LM/W3SVC/100000101/ROOT'  new log:'c:\temp\iirfLog.out.2432.log'
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: actual log file 'c:\temp\iirfLog.out.2432.log'
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: ini file: 'C:\Inetpub\wwwroot\HOPE\Iirf.ini'
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: ini file timestamp: 2009/11/10 10:04:02 Central Standard Time
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  14: LogLevel = 3
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  18: CondSubstringBackrefFlag *
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: setting CondSubstringBackrefFlag to '*'
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  19: MaxMatchCount 10
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  24: RewriteCond   %{QUERY_STRING}  ^$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  25: RedirectRule (rule 1)  '^/main.asp$'  '/' [I,R=301]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: INFO: line 25: Redirecting to a target that does not include an http(s):// scheme.
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig:                The rule will Redirect to a target on the local machine
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  27: RewriteCond   %{QUERY_STRING}  ^.+$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  28: RedirectRule (rule 2)  '^/main.asp(.*)$'  '/' [I,R=301]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: INFO: line 28: Redirecting to a target that does not include an http(s):// scheme.
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig:                The rule will Redirect to a target on the local machine
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  30: RewriteCond   %{QUERY_STRING}  ^$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  31: RedirectRule (rule 3)  '^/welcome.asp$'  '/' [I,R=301]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: INFO: line 31: Redirecting to a target that does not include an http(s):// scheme.
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig:                The rule will Redirect to a target on the local machine
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  33: RewriteCond   %{QUERY_STRING}  ^.+$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  34: RedirectRule (rule 4)  '^/welcome.asp(.*)$'  '/' [I,R=301]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: INFO: line 34: Redirecting to a target that does not include an http(s):// scheme.
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig:                The rule will Redirect to a target on the local machine
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  36: RewriteCond   %{QUERY_STRING}  ^$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  37: RewriteCond   %{REQUEST_FILENAME}  !-f
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  38: RewriteRule (rule 5)  '/(.+)\.htm$'  '/default.aspx?staticpage=$1'    [I,L]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  40: RewriteCond   %{QUERY_STRING}  ^.+$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  41: RewriteCond   %{REQUEST_FILENAME}  !-f
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  42: RewriteRule (rule 6)  '/(.+)\.htm(\??)(&?)(.*)$'  '/default.aspx?staticpage=$1&$4'    [I,L]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  45: RewriteCond   %{QUERY_STRING}  ^$
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  46: RewriteRule (rule 7)  '/(.+)\.(asmx|aspx|asp|css|gif|jpeg|jpg|ico|png|htm|html|js|txt|xml)$'  '$0'    [I,L]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  49: RewriteRule (rule 8)  '^(.*)/(rdr)(/?)(\??)(.*)$'  '$1/shurl/ShortURLRedirect.aspx?redir=$5'    [I,L]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: line  52: RewriteRule (rule 9)  '/(exec|default.aspx)(/?)(\??)(.*)$'  '/default.aspx/$4'    [I,L]
Tue Nov 10 10:04:19 -  5472 - ReadSiteConfig: Done reading, found 9 rules (0 errors, 0 warnings) on 90 lines
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_LOG
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_LOG
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Tue Nov 10 10:04:19 -  5472 - DoRewrites
Tue Nov 10 10:04:19 -  5472 - DoRewrites: Url (decoded): '/exec/action/customersearch/hspos/hsnet?pvs=backto.http://hopereview/exec/hspos/hsnet'
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: depth=0
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 1 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 2 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 3 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 4 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 5 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 6 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 7 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 8 : -1 (No match)
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Rule 9 : 5 matches
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Result (length 93): /default.aspx/action/customersearch/hspos/hsnet?pvs=backto.http://hopereview/exec/hspos/hsnet
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: Last Rule
Tue Nov 10 10:04:19 -  5472 - EvaluateRules: returning 1
Tue Nov 10 10:04:19 -  5472 - DoRewrites: Rewrite Url to: '/default.aspx/action/customersearch/hspos/hsnet?pvs=backto.http://hopereview/exec/hspos/hsnet'
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5608 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5608 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:19 -  5608 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:19 -  5608 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:20 -  5608 - HttpFilterProc: SF_NOTIFY_LOG
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Tue Nov 10 10:04:20 -  5472 - DoRewrites
Tue Nov 10 10:04:20 -  5472 - DoRewrites: Url (decoded): '/exec/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:'
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: depth=0
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 1 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 2 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 3 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 4 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 5 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 6 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 7 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 8 : -1 (No match)
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Rule 9 : 5 matches
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Result (length 80): /default.aspx/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: Last Rule
Tue Nov 10 10:04:20 -  5472 - EvaluateRules: returning 1
Tue Nov 10 10:04:20 -  5472 - DoRewrites: Rewrite Url to: '/default.aspx/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:'
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:20 -  5472 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:20 -  5608 - HttpFilterProc: SF_NOTIFY_URL_MAP
Tue Nov 10 10:04:20 -  5608 - HttpFilterProc: cfg= 0x014442D8
Tue Nov 10 10:04:21 -  5472 - HttpFilterProc: SF_NOTIFY_LOG

Coordinator
Nov 10, 2009 at 4:50 PM

Ah, interesting.

The first URL request that comes in is full - it is '/exec/action/customersearch/hspos/hsnet?pvs=backto.http://hopereview/exec/hspos/hsnet'

This gets rewritten correctly to '/default.aspx/action/customersearch/hspos/hsnet?pvs=backto.http://hopereview/exec/hspos/hsnet'

Then, there is an additional URL request that comes through.  It is '/exec/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:' 

it gets rewritten to '/default.aspx/action/customersearch/hopereview/exec/hspos/hsnet?pvs=backto.http:'

 

It seems IIRF is working correctly.  There is something sending in a truncated request though - not really what you told me you expected.

Nov 10, 2009 at 5:26 PM
Edited Nov 10, 2009 at 5:27 PM

I don't know where a second request would come from.  This log is from the page loading once.

The page loads fine with the urldecoding off.

Coordinator
Nov 10, 2009 at 5:39 PM

but you can see the 2nd request, right?  you can see that in the logfile.  It's definitely there. Coming from somewhere.

if its no problem, then don't worry about it.

"the page loads fine" - Are you saying that everything is working now?

Nov 10, 2009 at 6:12 PM

yes, with decoding off, the site seems to work correctly,

thanks

 

Coordinator
Nov 11, 2009 at 8:44 AM

ok, great.