0

I have the following url rewrite code in my web.config

I want to forward anything .htm to the brand.aspx.

so if anyone type in

test1.htm

test2.htm

test3.htm

would go to the brand.aspx. However, the following url rewrite would work if there is an actual file call "test1.htm" in the server, then it will redirect to the brand.aspx. If there is no file exists, it will just return 404 instead of redirect to the brand.aspx. Does anybody know why? thanks a lot.

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="test" stopProcessing="false">
<match url="(.*)\.htm$" ignoreCase="true" /> 
<action type="Rewrite" url="brand.aspx" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Julia
  • 1,207
  • 4
  • 29
  • 47

1 Answers1

0

There is a similar thread Using a custom URL rewriter, IIS6, and urls with .htm, .html, etc

I have experienced a similar issue before and i made a custom IHTTPModule

for which i used the guide at

http://msdn.microsoft.com/en-us/library/ms227673.aspx

Community
  • 1
  • 1
P6345uk
  • 703
  • 10
  • 26