asp.neturl-rewritingurlrewriting.net

urlrewriting.net map all classic asp requests to default.aspx


I'm using urlrewriting.net and want to add a rule to map all classic asp requests to default.aspx.

Unfortunately my attempt below just results in a redirect loop, so I must be doing something wrong.

    <add name="LegacyRedirect"
     virtualUrl="^~/(.*).asp"
     redirectMode="Permanent"
     redirect="Application"
     destinationUrl="~/default.aspx"/>

Many thanks, Ben


Solution

  • Seems I was missing $ at the end of my regular expression.

    Below is what worked for me (redirects all asp requests to the site root):

        <add name="LegacyRedirect"
         virtualUrl="^~/([^?]*)\.asp$"
         redirectMode="Permanent"
         redirect="Application"
         destinationUrl="~/"/>