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
No comments yet.