I have a perfectly functioning URL rewriting to remove the file extension. But when I use response.redirect, the URL rewrite doesn’t take place. Oddly, this occurs only when the URL is using the full path, not relative. For example:
response.redirect("http://example.com/page")
gives me http://example.com/page.asp
whereas response.redirect("/page") is fine.
URL rewrite code:
<rule name="rewrite asp">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).asp" />
</conditions>
<action type="Rewrite" url="{R:1}.asp" />
</rule>
I need to use the full path because I’m going from one domain to another. Any ideas?
You can maybe try something like this:
then in redirect.asp: