I got a problem with the creation of rewrite rule which is using a rewrite map in IIS. The goal is to rewrite requests like /Japan/test.html
or /Chile/test.html
to jp/en/simple-test
and cl/en/simple-test
.
Here is the rewrite rule:
<rule name="Rewrite sites" enabled="true" stopProcessing="true">
<match url="^/(.*)/test.html$" />
<conditions>
<add input="{Sites:{R:1}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}/en/simple-test" appendQueryString="false" />
</rule>
And this is my rewrite map:
<rewriteMap name="Sites">
<add key="chile" value="cl" />
<add key="japan" value="jp" />
</rewriteMap>
So once again, I want to dynamically translate all the languages into language codes and rewrite to language_code/en/simple-test
. I want to use rewrite map as there will be more languages.