Copied to clipboard

Flag this post as spam?

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


  • Christina 127 posts 390 karma points notactivated
    Feb 01, 2020 @ 11:27
    Christina
    0

    Rewrite url Issue redirect http->https Solved

    Hi I have problem with redirect http-https If someone else is struggling with this. I had wrong match url, its the url after domain. 3 sites in one installation, and 3 domains My problem if i type www.domain1.se it works and domain1.se it not working How can I change the action url?

      <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
    

    If I add https://www.{HTTP_HOST}/{R:1} it works with non www but not with www Man thanks! /Christina

    <rule name="HTTP to HTTPS redirect" 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>
    

    And for each domain

        <rule name="redirect to domian1.se" stopProcessing="true">
            <match url="(.*domain1.se)$" />// wrong it should be  (.*)
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                <add input="{HTTP_HOST}" pattern="(?!www)(.*domain1.se)$" />                        
           </conditions>
           <action type="Redirect" url="https://www.domain1\.se/{R:1}" redirectType="Permanent" />
        </rule>
    
  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Feb 03, 2020 @ 12:27
    Alex Skrypnyk
    100

    Hi Christina

    This should work:

    <rule name="HTTP to HTTPS redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
            <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
    
  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Feb 03, 2020 @ 12:27
Please Sign in or register to post replies

Write your reply to:

Draft