Umbraco.Cloud.Issues icon indicating copy to clipboard operation
Umbraco.Cloud.Issues copied to clipboard

IIS Rewrites not working for multiple cultures in current Cloud infrastructure.

Open sergiutesu opened this issue 3 years ago • 3 comments

Issue description

Issue: Rewrites work only for the default language, they won't work for another language.

I used CMS Version: 8.17.2

Steps to reproduce

  1. Make sure Umbraco has two languages image

  2. Make a doctype which is a culture variant and allow a root node image

  3. Create a node with this doctype for both languages and attach different culture hostnames for each language image image

  4. Write two similar rewrite rules one for each hostname and add them to the web.config

<rule name="EnglishProductsRewrites">
  <match url="(.*?)/c-([0-9]+)/c-([0-9]+)" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="custom-hostname.com" />
  </conditions>
  <action type="Rewrite" url="english-products/?catalog={R:2}" />
</rule>
<rule name="DanishProductRewrites">
  <match url="(.*?)/c-([0-9]+)/c-([0-9]+)" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="custom-hostname.dk" />
  </conditions>
  <action type="Rewrite" url="dansk-produkter/?catalog={R:2}" />
</rule>

After the above steps are done: You will notice that the rewrites only work for the default first language and the other languages won't work.

These are some samples: Trigger the 1st rewrite condition English version: https://custom-hostname.com.com/english-products/category/c-55/c-66 it's working fine

image

Trigger the 2nd rewrite condition Danish version: https://custom-hostname.dk/dansk-produkter/category/c-55/c-66 it's giving a 404 template not found.

image

The reason for the 404 in the background it will look for the english-products instead of the dansk-produkter, and it won't be able to find that. That is happening because english-products is the default culture.

sergiutesu avatar Feb 03 '22 16:02 sergiutesu