jeremy-h of Web Development
10/24/2017 - 4:23 PM

Web Config

Common setup for our IIS websites

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <!-- FORCE HTTPS -->
                <rule name="HTTP to HTTPS redirect" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
                </rule>
                <!-- ADD REDIRECTS -->
                <rule name="Redirect rule1 for CTSREDIRECTS">
                    <match url=".*" />
                    <conditions>
                        <add input="{CTSREDIRECTS:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" appendQueryString="false" />
                </rule>
            </rules>
            <rewriteMaps>
                <rewriteMap name="CTSREDIRECTS">
                    <!-- WRITE REDIRECTS -->
                    <add key="/index.html" value="/" />
                </rewriteMap>
            </rewriteMaps>
        </rewrite>
    </system.webServer>
  <system.web>
    <compilation targetFramework="4.5.1"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    <customErrors mode="Off"/>
  </system.web>
</configuration>