0

I'm trying to setup a 301 redirect for some pages on my site so I setup some rewrite mappings as:

<rewriteMap name="v2 structure">
          <add key="/what-we-do/why-us" value="/who-we-are/knowledge/why-us" />
          <add key="/what-we-do/why-us/sourcing-models" value="/who-we-are/knowledge/why-us/sourcing-models" />
</rewriteMap>

The site is multi language so the url will include the language:

www.domain.com/en/what-we-do/why-us should redirect to www.domain.com/en/who-we-are/knowledge/why-us www.domain.com/es/what-we-do/why-us should redirect to www.domain.com/es/who-we-are/knowledge/why-us

The mapping that I have doesn't trigger because of the language on the url. I can make it work by adding the language to the key and value on the mapping but i would had to repeat the mapping for each different language that the site has.

Is there a way to match trigger the rules mapped ignoring the language on the url?

Thank you, Joao

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
  • It seems not possible using a static map as you do. Have a look here: http://www.iis.net/learn/extensions/url-rewrite-module/using-rewrite-maps-in-url-rewrite-module "Notice that there is no obvious common pattern in the keys and their relation to values. This means that it is not possible to use regular expressions or wildcards to define URL transformation logic. Further, this means that if we had not used rewrite maps we would have had to create three rewrite rules. With rewrite maps we can create only one rewrite rule." – Andrea Salicetti Dec 10 '14 at 11:56
  • BTW, looks similar to http://stackoverflow.com/questions/10104896/iis7-rewrite-map-regex – Andrea Salicetti Dec 10 '14 at 11:59

0 Answers0