I am trying to implement two rules for IIS for redirecting not WWW to WWW and http to https.
http://zzz.com -> https://www.zzz.com http://www.zzz.com -> https://www.zzz.com https://zzz.com -> https://www.zzz.com
So, I added this to my web.config:
<system.webServer> <rewrite xdt:Transform="Insert"> <rules> <rule name="Force WWW" enabled="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^[^www]" /> </conditions> <action type="Redirect" url="https://www.zzz.com/{R:1}" appendQueryString="true" redirectType="Permanent" /> </rule> <rule name="Force HTTPS" enabled="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://www.zzz.com/{R:1}" appendQueryString="true" redirectType="Permanent" /> </rule> </rules> </rewrite>
My question is:
Is there a way to combine this in one rule?
asp.net-mvc iis
Noah Andreas
source share