Copied to clipboard

Flag this post as spam?

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


  • n00b 33 posts 134 karma points
    Dec 19, 2018 @ 10:28
    n00b
    0

    Force https & www

    Hi all, probably an easy one for experience devs, but for someone who isn't familiar with Umbraco..

    Here's a snippet of my web.config Any chance someone could tell me how to ensure all URLs entered will forward to the correct https://www version of the site please?

    https://paste.ofcode.org/kdZLVcSKX8fS3Hg4U4Xpsh

    Many thanks in advance

  • Thomas Beckert 176 posts 441 karma points
    Dec 19, 2018 @ 10:38
    Thomas Beckert
    0

    Try this one:

     <rewrite>
            <rules>
                <rule name="Add WWW" stopProcessing="true">
              <match url="^(.*)$" />
              <conditions>
                 <add input="{HTTP_HOST}" pattern="^(?!www\.)(.*)$" />
              </conditions>
              <action type="Redirect" url="https://www.{C:0}{PATH_INFO}" redirectType="Permanent" />
           </rule>
                <rule name="Force SSL" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    
  • n00b 33 posts 134 karma points
    Dec 19, 2018 @ 10:51
    n00b
    0

    Thanks - do I have to do anything after making the edits or will it pick it up? Eg compiling, flushing cache etc

  • Thomas Beckert 176 posts 441 karma points
    Dec 19, 2018 @ 10:54
    Thomas Beckert
    100

    Editing the web.config ist like flushing the cache. :) So it should work instantly.

  • n00b 33 posts 134 karma points
    Dec 19, 2018 @ 10:54
    n00b
    0

    Perfect, thank you!

  • 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