c# - IIS replace part of url -


i'm trying replace "se" "sv" in url using url rewrite in iis.

url this: www.somedomain.com/se/baadmarked/baade

and should this: www.somedomain.com/sv/baadmarked/baade

my current rule this:

<rule name="se sv" patternsyntax="ecmascript" stopprocessing="true">     <match url="(.*)" />     <action type="redirect" url="{c:1}sv{c:3}" appendquerystring="false" />     <conditions logicalgrouping="matchany">         <add input="{http_host}{query_string}" pattern="(.*)(se)(.*)" />     </conditions> </rule> 

i've tried lot, nothing gets job done.

it sounds want use rewrite feature , not redirect feature.

the rule should this:

<rule name="se sv">     <match url="^(.*)/se/(.*)" />     <action type="rewrite" url="{r:1}/sv/{r:2}" /> </rule> 

the match breaking rule 2 parts. first part domains , second part after se.

the action saying rewrite of these address {r:1} domain part, /sv/ {r:2} after se.

if did want redirect change action rewrite redirect. it's not clear.

you can still add stopprocessing="true" , appendquerystring="false" if need.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -