Ampersand or question mark in query parameters builds wrong URL
description
Hi All,
I have some trouble dealing with this rewrite rule, can you help me to find a solution?
The URL called:
/formas/sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive?&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489
The URL generated:
/formas/index.php\?q=sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive&&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489&r=1
And according to this rule:
RewriteRule (rule 2) '/formas/(.*)\?(.*)$' '/formas/index.php\?q=$1&$2&r=1' [I,L,U]
I expect an ampersand:
/formas/index.php\?q=sfx&try=301&...
Not a question mark (see the second parameter):
/formas/index.php\?q=sfx?try=301&...
Note: It works only when i turn UrlDecoding OFF.
Here is the log.
Thu Mar 29 15:01:15 - 3800 - -------------------------------------------------------
Thu Mar 29 15:01:15 - 3800 - Ionic ISAPI Rewriting Filter (IIRF) 2.1.2.3 x86 RELEASE
Thu Mar 29 15:01:15 - 3800 - IIRF was built on: Nov 11 2011 07:39:27
Thu Mar 29 15:01:15 - 3800 - Cached: DLL_PROCESS_ATTACH
Thu Mar 29 15:01:15 - 3800 - Cached: Process ID: 852
Thu Mar 29 15:01:15 - 3800 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(23): Filter Priority is now: HIGH (0x80000)
Thu Mar 29 15:01:15 - 3800 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(46): NotifyLog setting is now: OFF
Thu Mar 29 15:01:15 - 3800 - Cached: ReadServerConfig: C:\Program Files\Ionic Shade\IIRF 2.1\IirfGlobal.ini(63): RewriteEngine setting is now: ON
Thu Mar 29 15:01:15 - 3800 - Cached: DLL_PROCESS_ATTACH - complete
Thu Mar 29 15:01:15 - 3800 - Cached: GetFilterVersion
Thu Mar 29 15:01:15 - 3800 - GetLogFile: app:'/LM/W3SVC/1/Root/formas' new log:'C:\iirfLog\Formas.852.log'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: actual log file 'C:\iirfLog\Formas.852.log'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: ini file: 'c:\inetpub\wwwroot\formas\Iirf.ini'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: ini file timestamp: 2012/03/29 15:00:48 Central Standard Time (Mexico)
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: cfg(0x012C5AE8)
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: LogLevel = 3
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(6): IterationLimit 3
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(9): RewriteCond %{REQUEST_FILENAME} -f '[OR]'
Thu Mar 29 15:01:15 - 3800 - ParseCondModifierFlags: '[OR]'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(10): RewriteCond %{REQUEST_FILENAME} -d '(null)'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(11): RewriteRule (rule 1) '^' '-' [L]
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(15): RewriteRule (rule 2) '/formas/(.*)\?(.*)$' '/formas/index.php\?q=$1&$2&r=1' [I,L,U]
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(17): RewriteRule (rule 3) '/(.*)\?(.*)$' '/index.php\?q=$1&$2&r=2' [I,L,U]
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(20): RewriteCond %{REQUEST_FILENAME} !-f '(null)'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(21): RewriteCond %{REQUEST_FILENAME} !-d '(null)'
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(23): RewriteRule (rule 4) '^/formas/(.*)$' '/formas/index.php?q=$1&r=3' [I,U]
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: c:\inetpub\wwwroot\formas\Iirf.ini(25): RewriteRule (rule 5) '^/(.*)$' '/index.php?q=$1&r=4' [I,L,U]
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: INFO: No global NotifyLog - Unmangled URIs will not be logged.
Thu Mar 29 15:01:15 - 3800 - CountIniLines: ini file c:\inetpub\wwwroot\formas\Iirf.ini (26 lines)
Thu Mar 29 15:01:15 - 3800 - ReadVdirConfig: Done reading INI for vdir(/formas), found 5 rules (0 errors, 0 warnings) on 26 lines, in 1 modules
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: cfg= 0x012C5AE8
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: SF_NOTIFY_AUTH_COMPLETE
Thu Mar 29 15:01:15 - 3800 - DoRewrites
Thu Mar 29 15:01:15 - 3800 - DoRewrites: Url (decoded): '/formas/sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive?&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489'
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: depth=0
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: no RewriteBase
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: Rule 1: 1 match
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: Rule 1: evaluating condition
Thu Mar 29 15:01:15 - 3800 - ApplyUrlEncoding: out 'c:\inetpub\wwwroot\formas\sfx'
Thu Mar 29 15:01:15 - 3800 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(f) p(-f) => FALSE
Thu Mar 29 15:01:15 - 3800 - ApplyUrlEncoding: out 'c:\inetpub\wwwroot\formas\sfx'
Thu Mar 29 15:01:15 - 3800 - EvalCondition: Cond t(%{REQUEST_FILENAME}) op(d) p(-d) => FALSE
Thu Mar 29 15:01:15 - 3800 - EvalConditionList: rule 1, FALSE, Rule does not apply
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: Rule 2: 3 matches
Thu Mar 29 15:01:15 - 3800 - ApplyUrlEncoding: out '/formas/index.php\?q=sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive&&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489&r=1'
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: Result (length 378): /formas/index.php\?q=sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive&&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489&r=1
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: Last Rule
Thu Mar 29 15:01:15 - 3800 - EvaluateRules: returning 1
Thu Mar 29 15:01:15 - 3800 - DoRewrites: Rewrite Url to: '/formas/index.php\?q=sfx?try=301&source=EBSCO:ScienceDirect+(Via+SFX)&month=1&author=Sandra+C.+Jones&issue=4&ISBN=&article=Midwives+and+pregnant+women+talk+about+alcohol:+what+advice+do+we+give+and+what+do+they+receive&&day=1&publisher=Churchill+Livingstone&journal=Midwifery&ISSN=0266-6138&volume=27&recipient=&genre=article&publiPlace=Edinburgh&sender=&year=2011&pages=489&r=1'
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: cfg= 0x012C5AE8
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:15 - 3800 - HttpFilterProc: cfg= 0x012C5AE8
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: cfg= 0x012C5AE8
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: cfg= 0x012C5AE8
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: SF_NOTIFY_URL_MAP
Thu Mar 29 15:01:16 - 3800 - HttpFilterProc: cfg= 0x012C5AE8