All I want to do is 301 redirect from old URLs to new URLs:
from /xx/yy/somefile.html
to /xx/yy/somefile.aspx
some examples below:
add key="/products/DSD-72B-SP-summary.html" value="/products/DSD-72B-SP-summary.aspx"
add key="/products/DSD-72B-SP-detail" value="/products/DSD-72B-SP-detail.aspx"
add key="index.html" value="default.aspx"
add key="/product-selector.html" value="/products.aspx"
That is all but it doesn't seem to want to work in IIS 7.5 with URL rewrite 2.0.
I have tried at least 10-20 different rules, and rewrite map formats without any luck. In fact I have done this so many times I have had to wipe the rules and maps from IIS and totally recopy a web.config file from a backup to unscrew what I screwed with to try and make it work.
All I need is a simple rule that tells IIS that if it gets a request for a *.html file to display the *.aspx file that replaced the html file.
<?xml version="1.0" encoding="UTF-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings configProtectionProvider="DataProtectionConfigurationProvider">
<EncryptedData>
<CipherData>
</CipherData>
</EncryptedData>
</appSettings>
<connectionStrings configProtectionProvider="DataProtectionConfigurationProvider">
<EncryptedData>
<CipherData>
</CipherData>
</EncryptedData>
</connectionStrings>
<system.web>
<customErrors mode="On" defaultRedirect="404-NotFound.aspx">
<error statusCode="404" redirect="404-NotFound.aspx" />
<!--<error statusCode="403" redirect=""/>-->
</customErrors>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<!--<codeSubDirectories>
<add directoryName="CSharp"/>
<add directoryName="VB"/>
</codeSubDirectories>-->
</compilation>
<authentication mode="Forms">
</authentication>
<membership>
<providers>
<clear />
</providers>
</membership>
<profile>
<providers>
<clear />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<defaultDocument>
<files>
</files>
</defaultDocument>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/404-NotFound.aspx" responseMode="ExecuteURL" />
</httpErrors>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="WWW Server" areas="Rewrite" verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="200-500" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>