Redirect to WWW using Web.config Print

  • 2

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>

Was this answer helpful?

« Back