Copied to clipboard

Flag this post as spam?

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


  • Donna Beger 17 posts 136 karma points
    Jul 25, 2024 @ 16:13
    Donna Beger
    0

    Umbraco Cloud Url Rewrite Rule non-www to www.

    I copied this rule directly from Umbraco documentation, but it doesn't work.

    I sometimes get redirected to www. and sometimes not. The negates don't work - which especially causes a problem on localhost. Removing the rule from web.config didn't take effect right away. I had to clear cache.

    The only other rule (HTTP to HTTPS) is working.

     <rule name="Redirect to www prefix" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\." negate="true" />
        <add input="{HTTP_HOST}" pattern="^localhost(:[0-9]+)?$" negate="true" />
        <add input="{HTTP_HOST}" pattern="\.umbraco\.io$" negate="true" />
      </conditions>
      <action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />
    </rule>
    

    Version: Umbraco Cloud 13.x

    What have you used that works?

  • molu 6 posts 77 karma points c-trib
    Jul 30, 2024 @ 13:04
    molu
    0

    Hi Donna. Try this:

    <rule name="Redirect to www" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^yourdomain\.com" ignoreCase="true" />
        </conditions>
        <action type="Redirect" url="https://www.yourdomain.com/{R:1}" />
    </rule>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies