I think this should work:
<rule name="Redirect to WWW" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^www\.example\.com$" negate="true" /> </conditions> <action type="Redirect" url="http://www.example.com/{R:1}" /> </rule>
If this does not work properly, you can try adding another condition:
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
Hope this helps.
source share