Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 884 posts 2393 karma points
    Dec 18, 2019 @ 12:08
    Claushingebjerg
    0

    UrlAlias, redirects, www and https

    Umbraco 7.5.4

    so a bit of a mind bender for me...

    I have a site where i redirect the user to the "https" version of the site, and then on to the "www", like so

        <rule name="Redirect to https" stopProcessing="true">
         <match url="(.*)" />
         <conditions>
          <add input="{HTTPS}" pattern="off" ignoreCase="true" />
         </conditions>
         <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
    
    <rule name="Canonical name" stopProcessing="true">
     <match url="(.*)" />
      <conditions>
       <add input="{HTTP_HOST}" negate="true" pattern="^www\.mydomain\.dk$" />
      </conditions>
      <action type="Redirect" url="https://www.mydomain.dk" redirectType="Permanent" />
    </rule>
    

    The thing is, now UrlAliases only work on the "www" version of the site, on the "non www" i get the front page of the site...

  • Yakov Lebski 426 posts 1653 karma points
    Dec 23, 2019 @ 18:38
    Yakov Lebski
    100

    All non www do redirect to homepage in your case? I think that you miss {R:1} in canonical name -

    <rule name="Canonical name" stopProcessing="true">
     <match url="(.*)" />
      <conditions>
       <add input="{HTTP_HOST}" negate="true" pattern="^www\.mydomain\.dk$" />
      </conditions>
      <action type="Redirect" url="https://www.mydomain.dk/{R:1}" redirectType="Permanent" />
    </rule>
    
Please Sign in or register to post replies

Write your reply to:

Draft