Special characters in URL


In CMS v.12 there seems to have been a change in how rewrites and redirects are being handled. If we try to access a not existing page we get the correct error page, which is great, but if type any special characters in the url, like 'https://localhost:44353/ačiū', we get

We have RewriteRules.xml that is supposed to handle this, and have tried this ChatGPT suggestion but the outcome is the same


Anyone has any suggestions? = )

Jun 30, 2023 8:45

How does your redirects look like? According to Chrome Dev Tools, you are entering a infinite redirect loop.

I've tested two sites running CMS 12 with the URL /ačiū/ and they both show their regular 404 page, as expected.

Jul 03, 2023 6:44

The infinite loop has been resolved by adding this to the rewrite.xml

Jul 03, 2023 12:26

Problem resolved then? Or still any issues?

I do not really understand why you need to redirect to the lowercase URL if someone enters with an URL with one or more uppercase characters...?

Jul 03, 2023 12:53
EVT - Jul 03, 2023 14:22
The situation is flaky, we are still experimenting with different examples from Google : D
To answer your 2nd question so that it would find the correct page and would return the correct error page if content is expired or never existed. It did not seem to match expired content if lower and upper cases were mixed (and returned the wrong error page).

Ok so this is the latest.

Without the lowerCase rule in the .xml we do not have any issues with the unicode or the upper case characteres, but the url looks ugly (e.g. https://localhost:44353/bEEr).

Adding the lower case rule to the .xml solves this issue but creates a new one with the encoding (the infinite loop). 

Adding the url encode solves the infinite loop but starts encoding characters that should not be encoded, like "/".

This is the outcome after adding this rule: https://localhost:44353/bEEr-in-LITHuania/report => https://localhost:44353/beer-in-lithuania%2freport

Any ideas how to write the rule so that both - lowercase and unicode - would work?

Jul 05, 2023 7:41

I tested locally with one single rule:

        <clear />
        <rule name="LowerCase" stopProcessing="true">
          <match url=".*[A-Z].*" ignoreCase="false" />
            <add input="{REQUEST_METHOD}" matchType="Pattern" pattern="GET" ignoreCase="false" />
          <action type="Redirect" url="{ToLower:{R:0}}" />

This works as expected and   /bEEr-in-LITHuania/report    is redirected to    /beer-in-lithuania/report 
Also no problem with URLs like ačiū

It looks like your infinite loop is alternating between the same URL with and without a trailing slash (/).

I think you can safely remove the UrlEncode part from your lowercase-redirect, and focus on your other redirects instead. I think you will see that this works if you remove your other redirect rules...

Jul 05, 2023 10:44

Trying to resolve this starts to feel as an infinite loop :D

Removed .xml with the rules, encoding works, not the lower cases (issue - ugly looking url). Adding .xml with only the lower case rule => infinite loop.

Jul 05, 2023 11:52

Used this guide but added my changes that are mentioned in my comment there.

Jul 25, 2023 12:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.