Redirect to WWW using Web.config

Add the source code following in system.webServer section (web.config):

<rewrite>
  <rules>
    <rule name="WWW" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^YOUR-DOMAIN.COM$" />
      </conditions>
      <action type="Redirect" url="http://www.YOUR-DOMAIN.COM/{R:0}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

A Web Service example

In the following example we will use ASP.NET to create a simple Web Service that converts the...

Connection string for Web.config

connectionString="Data Source=IP-ADDRESS;Initial Catalog=YOUR-DATABASE;User...

Crystal Reports version

We have upgraded SAP Crystal Reports 2013 SP25 (Runtime Engine for .NET Framework 4) to SP26 for...

Enable error message for Web.config

To enable the details of this specific error message to be viewable on remote machines, please...

Redirect to HTTPS using Web.config

Add the source code following in system.webServer section (web.config): <rewrite>...