Friday, November 10, 2017

URL redirect rule for rewriting non-www to www



You can add below rule by manually in web.config.

In the <system.webServer> section of your web.config, add the following:

<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>

1 comment:

  1. Kentico 12 migration I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.

    ReplyDelete