Web Development Company

We offer custom software and Web development services under our proven offshore model
Web.config 301 Redirect – asp.net

Tuesday, May 3rd, 2011 | Asp.Net, asp.net web development, web application development, web designing | admin


The Asp.Net 301 permanent redirect is the most search engine-friendly method of redirection to the new URL or page and is the current standard for SEO purposes.

Step 1

Download and enable the URL Rewrite module for IIS 7. Then the following code is used in the ASP.NET web.config file:

Step 2

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

Comments

0 Comments

No comments yet.


What is 7 + 13 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)