Monday 4 May 2009

IIS7 - 301 redirect at the page level

In IIS6 redirecting individual pages properly (using a 301 redirect) was a little tedious, you had to create a physical page as a stub then poke around in the settings to forward requests on to the new location.

IIS7 is a little easier, for those of you who are familiar already it won't suprise you that it's just another line in the good old web.config...


<location path="index2.html">
<system.webServer>
<httpRedirect enabled="true" destination="Default.aspx" exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
</system.webServer>
</location>


If you place the above snippet inside the tag for each file you wish to redirect, simple!

1 comment:

yogesh.narayanan said...

Good one really was very helpful to freshers like me

Also i use 301 redirect checker to confirm the same.