this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Monday, July 4, 2011

Redirect old page to new page with use of web.config

Recently we found that some of our old links were broken as we have changed our page name to make it seo friendly. Suddenly, over the night our site’s page rank was down. It was really embarrassed situation for all of us.

There were below reason for it.

As we have moved our server from linux to windows platform and there were no idea of page rename, and lack of technical availability to use htaccess redirection in windows platform.

After some work around it, finally I came across following things which is very good and needs to use when we rename any page and don’t want old link should be break.

Here, please not that following things will work on IIS 7.0+

First block will resolve canonical issue of prefix www before any domain name.

Second block will redirect my old page link to new mapped page.

<rule name="Redirect to WWW" stopProcessing="true">

<match url=".*" />

<conditions>

<add input="{HTTP_HOST}" pattern="^mydomain.com$" />

</conditions>

<action type="Redirect" url="http://www.mydomain.com/{R:0}" redirectType="Permanent" />

<rule>

<rule name="redirect to new java page" stopProcessing="true">

<match url="^javadeveloper.html" />

<action type="Redirect" url="java-development-services.html" redirectType="Found" />

</rule>

No comments: