301 redirect.html to .aspx pages when migrating static website into .net hosted under IIS608/16/2011
301 redirects are very important for SEO when moving website pages to new locations. They are easy to implement when you switch from one scripting language to the other (i.e. from .asp to .aspx or from .php to .asp). All you need to do in this case is keep the legacy pages in your website and put 301 redirect code in them.
The problem comes in when you are trying to convert static .html or .htm website into .aspx. HTML file can't execute any code thus create a major challenge for implementing 301s.
Here's the proposed solution:
Right-click your website in IIS6 and select "Properties". Click on the "Home Directory" tab:
Now click on the Configuration button.
Click Add button and add ISAPI mapping for .html extension so that aspnet_isapi.dll handles all html requests. If you don't want to keep old .html files in the new website make sure you uncheck Verify that file exists checkbox.
Now every request for .html page will go through asp.net managed pipeline.
Add the following code to the Application_BeginRequest method of the Global.asax file in your new .NET website:
The code checks if the incoming request is for .html page and in that case creates a 301 redirect to .aspx page with the same name. If the names of the new .aspx pages are different from .html names, you can define those mappings in XML file or in database table and lookup new URLs that way.