URL Rewrite / Enforce lowercase URLs with exceptions

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi guys, I'm having a little trouble with URL's being forced to lowercase.

Currently all URLs are being converted to lowercase which is all good with the exception that we need to implement a string after the site path which requires uppercase letters (eg www.{SITE}.com/?ranmid=02937&ranEAID=lMh2Xiq9xN...).

As I'm taking over the project, I'm not sure where or how the URLs are already being converted to lowercase but I've checked Web.config and can't see any rule in there.

So what I want to achieve is to stop the string being converted to lowercase, is there any way to do this? eg if url contains 'section of string' then do not convert. This is the rule I've been trying to add to Web.Config so far but with no luck. Any help would be appreciated!

<rule name="ForceLowerCase" enabled="true" stopProcessing="false">
          <match url="[A-Z]" ignoreCase="false" />
          <action type="Redirect" url="{ToLower:{URL}}" />
          <conditions>
            <add input="{URL}" pattern="^/?ranmid=02937" negate="true" />
          </conditions>
        </rule>
7 years ago
As far as I know the only code in nop that enforces lowercase urls by default is in the generation of the SEO friendly urls, which wouldn't affect querystrings. For example you can browse to this url on the nop demo site with no change to the casing of the querystring: http://demo.nopcommerce.com/?SomeParameter=SomeValue

If you're seeing different behaviour it's possible that you've already got a URL rewrite rule setup in IIS to enforce the lowercase URLs.
7 years ago
petemitch wrote:
As far as I know the only code in nop that enforces lowercase urls by default is in the generation of the SEO friendly urls, which wouldn't affect querystrings. For example you can browse to this url on the nop demo site with no change to the casing of the querystring: http://demo.nopcommerce.com/?SomeParameter=SomeValue

If you're seeing different behaviour it's possible that you've already got a URL rewrite rule setup in IIS to enforce the lowercase URLs.


If I were to remove this rule in IIS, would the code I wrote above work or would it need any reworking?
7 years ago
DanielRavens wrote:
If I were to remove this rule in IIS, would the code I wrote above work or would it need any reworking?

If there was nothing changing the URLs to lowercase I don't see why you would require any code.
5 years ago
petemitch wrote:
As far as I know the only code in nop that enforces lowercase urls by default is in the generation of the SEO friendly urls, which wouldn't affect querystrings. For example you can browse to this url on the nop demo site with no change to the casing of the querystring: http://demo.nopcommerce.com/?SomeParameter=SomeValue

If you're seeing different behaviour it's possible that you've already got a URL rewrite rule setup in IIS to enforce the lowercase URLs.


This isn't true at all.  NopComerce doesn't change the case.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.