Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon Free 14 posts 34 karma points
    Apr 15, 2016 @ 16:03
    Jon Free
    0

    URL Rewrite Rule breaks Login

    I've applied the following rewrite rule via IIS 7's rewrite module and it seems to break the login page. Why would that be?

        <rule name="LowerCase" stopProcessing="true">
          <match url="[A-Z]" ignoreCase="false" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
          <action type="Redirect" url="{ToLower:{URL}}" />
        </rule>
    
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Apr 16, 2016 @ 08:23
    Sebastiaan Janssen
    0

    Probably because the login posts to PostLogin which then gets redirected and in that redirect your posted values get lost.

    First of all: I'll make an assumption that you're doing this for SEO purposes.. in which case you should probably stop listening to SEO swindlers, the casing of the URLs really doesn't matter ;-)

    But if you must do this you can to fix this:

    <rules>
        <rule name="LowerCase" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
             <conditions>
              <add input="{URL}" negate="true" pattern="^~/umbraco$" />
             </conditions>
            <action type="Redirect" url="{ToLower:{URL}}" />
        </rule>
    </rules>
    

    You might still run into other unexpected problems though, good luck! :-)

  • Jon Free 14 posts 34 karma points
    Apr 19, 2016 @ 10:34
    Jon Free
    0

    Hmmm it doesn't match the urls for some reason and on the basis of I personally hate Regex I think I'll just leave it out...

  • twizted 1 post 71 karma points
    May 09, 2016 @ 14:04
    twizted
    0

    I had this problem today and found a solution:

    <rewrite>
        <rules>
          <!-- Redirect rule to force all URLs to lowercase -->
          <rule name="LowerCaseRule" stopProcessing="true">
            <match url="[A-Z]" ignoreCase="false" />
            <action type="Redirect" url="{ToLower:{URL}}" />
            <conditions>
              <add input="{REQUEST_URI}" pattern="^.*/umbraco" negate="true" />
              <add input="{REQUEST_URI}" pattern="^.*/install" negate="true" />
            </conditions>
          </rule>
        </rules>
      </rewrite>
    
  • David Quinlan 2 posts 22 karma points
    Aug 25, 2020 @ 16:27
    David Quinlan
    0

    Do you have a version of this rule that works with ClientDependency? I'm having issues with tolower, I just can't seem to get it to ignore anything from ClientDependency.

    I've tried adding

    <add input="{REQUEST_FILENAME}" pattern="DependencyHandler.axd" negate="true" />
    <add input="{REQUEST_URI}" pattern="(.*?)\.axd$" negate="true" />
    

    etc..

    but it doesn't work. When I try and login to umbraco back end, I can see in console that the urls have been modified by towlower and PostLogin method is showing error 405

    I also have the above listed /umbraco / install condidtions.

    (on umbraco version 8.6.1)

  • David Quinlan 2 posts 22 karma points
    Aug 25, 2020 @ 17:33
    David Quinlan
    0

    I have figure out the answer..

    Apply the folder exclusion to umbracoapi folder and it all plays nice..

    <add input="{URL}" pattern="umbracoapi" negate="true" />
    

    So far! :)

Please Sign in or register to post replies

Write your reply to:

Draft