use map with Default value under a RewriteRule

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 1
Joined: 05 Nov 2015, 15:56

use map with Default value under a RewriteRule

05 Nov 2015, 16:26

I try to use the map function with a default value when I don't have any value. I use a variable who can be undefined, when that the case, the map function don't look to work. Is it a way to use a undefined variable with the map function?

${ MapName : LookupKey | DefaultValue }
Source: http://www.helicontech.com/isapi_rewrite/doc/RewriteMap.htm

c:/mapsfiles/LangID.txt
Code: Select all
1 en


Code: Select all
RewriteMap langIDmap txt:c:/mapsfiles/LangID.txt
RewriteCond %{QUERY_STRING} ^arg1=test(?:.*&langid=(\d+).*)? [NC]
RewriteRule ^(.*)$ /newfolder/${langIDmap:%1|en}/? [L,R=301]


If I pass my optional value &langid=1, everything work as expected
http://www.mydomain.com/index.cfm?arg1=test&arg2=7&arg3=88&langid=1
Result: /newfolder/en/

But If I don't have it. the map function don't work at all.

http://www.mydomain.com/index.cfm?arg1=test&arg2=7
Result : /newfolder/%24%7BlangIDmap:|en%7D/
Expected : /newfolder/en/

Thanks in advance for your help.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 3 guests