Umbraco.Cloud.Issues
Umbraco.Cloud.Issues copied to clipboard
IIS Rewrites not working for multiple cultures in current Cloud infrastructure.
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
-
Make sure Umbraco has two languages
-
Make a doctype which is a culture variant and allow a root node
-
Create a node with this doctype for both languages and attach different culture hostnames for each language
-
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
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.
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.