0
votes

I have an http to https redirect rule which works as expected. However, I cannot get a separate rule for page redirects to work when I have the http to https rule enabled. I have limited experience working with web.config and site configurations so I am having trouble determining what the issue is.

I tried disabling the http to https rule and the "Old Page Redirects" rule was working as expected after that. But I need both rules enabled. I have included the rewrite rules here as well as a sample from the rewrite map. Note that I also have a couple rules in place for my CMS to create SEF URLs.

       <rewrite>
        <rewriteMaps configSource="Web.RewriteMaps.config" />
           <rules>
                <rule name="Old Page Redirects" stopProcessing="true">
                        <match url=".*" />
                    <conditions>
                        <add input="{OldPages:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                        <action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
               </rule>
               <rule name="CMS Rule 1" stopProcessing="true">
                   <match url="^(.*)$" ignoreCase="false" />
                   <conditions logicalGrouping="MatchAny">
                       <add input="{QUERY_STRING}" pattern="base64_encode[^(]*\([^)]*\)" ignoreCase="false" />
                       <add input="{QUERY_STRING}" pattern="(>|%3C)([^s]*s)+cript.*(&lt;|%3E)" />
                       <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
                       <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
                   </conditions>
                   <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
               </rule>
               <rule name="CMS Rule 2">
                   <match url="(.*)" ignoreCase="false" />
                   <conditions logicalGrouping="MatchAll">
                     <add input="{URL}" pattern="^/index.php" ignoreCase="true" negate="true" />
                     <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                   </conditions>
                   <action type="Rewrite" url="index.php" />
               </rule>
                <rule name="HTTP to HTTPS" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>

           </rules>
       </rewrite>
<!-- sample key and value from rewrite map is below -->
<rewriteMaps>
  <rewriteMap name="OldPages">
    <add key="/closeup.asp?pid=2115" value="/furniture/cabinets-chests/rosewood-dragon-phoenix-design-armoire-b0hc02xc" />
  </rewriteMap>
</rewriteMaps>
1

1 Answers

0
votes

Looks like the issue was just a matter of priority. I moved the http to https rule to the top and the redirects were working as expected after that.