IIS7/8 URL Rewrite ? rewriting non-www to www

In order to Redirect non-www to www on your website, manually edit the web.config file of site and add the following rewrite rule:
[xml]
<rewrite>
<rules>
<rule name=”Redirect example.com to www” patternSyntax=”ECMAScript” stopProcessing=”true”>
<match url=”.*” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”^example.com$” />
</conditions>
<action type=”Redirect” url=”http://www.example.com/{R:0}” />
</rule>
</rules>
</rewrite>

[/xml]


Posted

in

, , ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *