2

I am trying to use IIS rewrite module to redirect https to another https.

This is what i have tried:

test 1:

<rewrite>
      <rules>
        <rule name="Redirect Maps Rule" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{StaticRedirects:{PATH_INFO}}" pattern="(.+)" />
          </conditions>
          <action type="Redirect" url="{C:1}" appendQueryString="True" redirectType="Permanent" />
        </rule>
      </rules>
      <rewriteMaps>
        <rewriteMap name="StaticRedirects">
          <add key="https://sub.olddomain.com/sitename" value="https://sub.newdomwain.co.uk/sitename" />
        </rewriteMap>
      </rewriteMaps>
    </rewrite>

test 2:

<rule name="https test" stopProcessing="true">
  <match url=".*" />
    <conditions logicalGrouping="MatchAny">
      <add input="{URL}" pattern="https://sub.olddomain.com/sitenam$" />
    </conditions>
    <action type="Redirect" appendQueryString="false" url="https://sub.newdomain.co.uk/sitename" redirectType="Permanent" />
</rule>

Neither worked, i currently use IIS rewrite for HTTP to HTTPS and also HTTP to HTTP which both work fine so not sure what i have got wrong here. Both sites are using the same wildcard SSL certificate and same IP.

IIS version 7.5

Slipeer
  • 3,295
  • 2
  • 21
  • 33
Barnsley
  • 31
  • 1
  • 4

0 Answers0