Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Removing WWW and redirecting to https (Both as needed)

$
0
0

Im on W2k8 R using the URL Rewrite module to generate the following in my web.config file....

        <rewrite>
            <rules>
                <clear />
                <rule name="Remove WWW" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^www.exceed.ri\.gov$" />
                    </conditions>
                    <action type="Redirect" url="https://exceed.ri.gov/{R:1}" appendQueryString="false" />
                </rule>
                <rule name="HTTP to HTTPS Redirect" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://exceed.ri.gov/{R:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>

I want the resulting to be https://exceed.ri.gov regardless of the input protocol (http/https) or wether there is a leading www on the url.   I've tried many variations of this but never accomplished my mission.  Seems I can only get one to work at a time.


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>