I've been trying for a few hours now to set up a non-www to www redirect on IIS 8.5 and am failing miserably. I am able to get the home page to force www but all other pages fail. I'm not really an IIS user so this is the first time I have had to do this. So far I have the following:
<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="domain.co.uk$" />
</conditions>
<action type="Redirect" url="https://www.domain.co.uk/{R:0}" />
</rule>
I have also tried the below rule from OStraining without any luck.
<rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.co.uk$" />
</conditions>
<action type="Redirect" url="https://www.domain.co.uk/{R:0}" />
</rule>
Can any one assist or shed any light on this?