Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Canonical Redirect using IIS 7.0  (Read 3489 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
Canonical Redirect using IIS 7.0
« on: July 26, 2014, 03:13:23 pm »
We can see some request that Cx want their domain redirect to WWW always. We can configure the same by adding below code to web.config.

Code: [Select]
<configuration>
  <system.webServer>
    <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>
  </system.webServer>
</configuration>

Thank you,