Proper method to remove www from address using IIS URL Rewrite
If you want it to work with any hostname (not hardcoding it into the rule), you’d want to do something like this: <rule name=”Remove www” stopProcessing=”true”> <match url=”(.*)” ignoreCase=”true” /> <conditions logicalGrouping=”MatchAll”> <add input=”{HTTP_HOST}” pattern=”^www\.(.+)$” /> </conditions> <action type=”Redirect” url=”http://{C:1}/{R:0}” appendQueryString=”true” redirectType=”Permanent” /> </rule> in the redirect action, the {C:1} contains the second capturing group … Read more