7

[Question transposed from Slack] We are trying to create a site with a virtualFolder of /chr. When we navigate to home page in the site, the system redirects us back to the site root. We have checked aliases, mod_rewrite/helicon ape/urlRewrite, and ignoreUrlPrefixes and all that stuff to no avail.

We have noticed the following works with no issue:

  • /ch-r
  • /chr1
  • /chs

Does anyone have any idea what is going on here?

1 Answer 1

14

Props to @rosscartwright, @cassidydotdk, and @jammykam for getting us to the answer at lightning speed and for the helpful links.

The issue was a feature of Sitecore called AlwaysStripLanguage that is controlled by a Sitecore Setting in the Language group that controls the activation of a processor in the <preprocessRequest /> pipeline called Sitecore.Pipelines.PreprocessRequest.StripLanguage.

Turns out that this component will not only remove URL prefixes it recognises as a language registered on the site (in /sitecore/system/Languages), but it will respond to any code that maps to a culture known to Windows.

For a list of the known culture codes check this ISO 639-2 Language Code List - you will notice that in our case the issue was the Cherokee language.

There is also an article on Sitecore Community - Prevent the Sitecore ASP.NET CMS from Interpreting URL Path Prefixes as Language Names that is a port of an old article by @JohnWest.

In our case we have replaced the default processor with a new one that only removes a language if it is configured in the list of languages for the site. Note that as it states in John's article, these processors run before there is a site context as the Site Resolver is in the httpRequestBegin pipeline that runs later. Mileage will vary - build yourself a solution that suits your use case.

I will upload our solution to the Sitecore Marketplace in due course so if you're looking for it, have a poke around in there.

3
  • Thanks for bringing this in here :-) You are welcome to mark your own answer as valid - this is encouraged behaviour in this case.
    – Mark Cassidy
    Commented Sep 14, 2016 at 10:51
  • @MarkCassidy - SO makes me wait 2 days to mark my own answer; but feel free (might be because I only have 150 rep in this new site) Commented Sep 15, 2016 at 0:24
  • All good :-) I can't mark it - only you can :-)
    – Mark Cassidy
    Commented Sep 15, 2016 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.