Force URL language prefix with Sitecore

Is there a parameter to force the language in the url? For example, if I go to http://www.site.com , I should be redirected to http://www.site.com/en , since now I see the start page without a language prefix.

LinkManager configured to always insert a prefix so that all links look at least.

+3
source share
2 answers

Another use case is SEO Friendly URL Module .

This module implements a custom LinkProviderone that provides an SEO Friendly URL and forces objects to access through their friendly URL.
Therefore, if an element is accessible without a language code in a URL (for example /my-item), the module redirects 301 URLs with a language code (for example /en/my-item).
That is, if you configured it to force a friendly URL ( forceFriendlyUrl="true") and set it languageEmbedding="always".

We use this module on our corporate website , so take a look at this to see it in action.

+6
source

You can use the ISS URL Rewrite to redirect / to / ru

IIS . iIS gui web.config

, .

system.webServer web.config

<system.webServer>
    <rewrite>
        <rule name="redirert / to en" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{PATH_INFO}" pattern="^/$" />
                </conditions>
                <action type="Redirect" url="/en/" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

hitten "/" "/en"

0

All Articles