Try our conversational search powered by Generative AI!

Special characters in URL

EVT
EVT
Vote:
 

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

Image

Anyone has any suggestions? = )

#304353
Jun 30, 2023 8:45
Vote:
 

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.

#304491
Jul 03, 2023 6:44
EVT
Vote:
 

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

#304512
Jul 03, 2023 12:26
Vote:
 

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...?

#304513
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).
EVT
Vote:
 

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?

#304664
Jul 05, 2023 7:41
Vote:
 

I tested locally with one single rule:

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

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...

#304683
Jul 05, 2023 10:44
EVT
Vote:
 

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.

#304692
Jul 05, 2023 11:52
EVT
Vote:
 

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

#305683
Jul 25, 2023 12:46
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.