Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Setting Up Multilingual URL Rewriting In Ucommerce for Kentico

In case you installed the Kentico accelerator for Ucommerce, the URL rewrite rules can be found in section in web.config file under your website.

This section contains following "default" rules

    
        <rule name="DefaultCategoryProductRewrite">
            <match url="(.*)/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" />
            <action type="Rewrite" url="catalog/product.aspx?catalog={R:2}&category={R:3}&product={R:4}" />
        </rule>
        <rule name="DefaultProductRewrite">
            <match url="(.*)/c-([0-9]+)/p-([0-9]+)" />
            <action type="Rewrite" url="product.aspx?catalog={R:2}&product={R:3}" />
        </rule>
        <rule name="DefaultCategoryRewrite">
            <match url="(.*)/c-([0-9]+)/c-([0-9]+)" />
            <action type="Rewrite" url="catalog.aspx?catalog={R:2}&category={R:3}" />
        </rule>
        <rule name="DefaultCatalogRewrite">
            <match url="(.*)/c-([0-9]+)" />
            <action type="Rewrite" url="catalog.aspx?catalog={R:2}" />
        </rule>
    

In case you want to set up multilingual store, you need to specify new set \of rules and put them before the "default" rules

    
        <rule name="MultilingualCategoryProductRewrite">
            <match url=".*([A-z]{2}-[A-z]{2}\/).*/c-([0-9]+)/c-([0-9]+)/p-([0-9]+)" />
            <action type="Rewrite" url="{R:1}catalog/product.aspx?catalog={R:2}&category={R:3}&product={R:4}" />
        </rule>
        <rule name="MultilingualProductRewrite">
            <match url=".*([A-z]{2}-[A-z]{2}\/).*/c-([0-9]+)/p-([0-9]+)" />
            <action type="Rewrite" url="{R:1}product.aspx?catalog={R:2}&product={R:3}" />
        </rule>
        <rule name="MultilingualCategoryRewrite">
            <match url=".*([A-z]{2}-[A-z]{2}\/).*/c-([0-9]+)/c-([0-9]+)" />
            <action type="Rewrite" url="{R:1}catalog.aspx?catalog={R:2}&category={R:3}" />
        </rule>
        <rule name="MultilingualCatalogRewrite">
            <match url=".*([A-z]{2}-[A-z]{2}\/).*/c-([0-9]+)" />
            <action type="Rewrite" url="{R:1}catalog.aspx?catalog={R:2}" />
        </rule>
    

These rules are made to match the scenario, when the culture code follows directly the host name (e.g. www.yourwebsite.com/en-GB/). You can customize these rules to match the pattern of your URL.

The default Kentico specific implementation of IUrlService first tries to use CultureAlias if it is available and in case it is not, it will use CultureCode instead. Please note that the accelerator doesn't come with rewrite rules for page aliases and it is your own responsibility to create appropriate rewrite rules. You can draw inspiration from the multilingual rules.