All you need to do is to add a rule into the rewrite module section:
<rule name="Force non-WWW" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://{C:2}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
</rule>
Your rewrite
section should look like this:
<rewrite>
<rules>
<rule name="Force non-WWW" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
</conditions>
<action type="Redirect" url="https://{C:2}{REQUEST_URI}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Top comments (0)