views:

308

answers:

0

I am trying to use URLRewritingNet to rewrite a website. The entire website is built using physical .aspx pages, and all I require is for them to show up as extensionless.

I figured out the extensionless part and all of my root files work fine (~/default.aspx. ~/contact.aspx, etc). The problem comes when I have a physical file in a physical sub directory (~/sub/default.aspx, or ~/sub/contact.aspx). When this scenario is present, I get a 404 error when navigating to www.example.com/sub/contact

Here are my URL Rewrites

        <rewrites>
        <!--Allow Extensionless Page-->
        <add name="pageExtensionless"
             virtualUrl="^~/(.+)$"
             redirectMode="Permanent"
             rewriteUrlParameter="ExcludeFromClientQueryString"
             destinationUrl="~/$1.aspx"
             ignoreCase="true" />
        <!--Fix the WebResource JS Error-->
        <add name="WebResourceFix"
             virtualUrl="^~/WebResource.axd(.*)"
             rewriteUrlParameter="IncludeQueryStringForRewrite"
             destinationUrl="~/WebResource.axd$1"
             ignoreCase="true"/>
        <!--Fix the ScriptResource JS Error-->
        <add name="ScriptResource"
             virtualUrl="^~/ScriptResource.axd(.*)"
             rewriteUrlParameter="IncludeQueryStringForRewrite"
             destinationUrl="~/ScriptResource.axd$1"
             ignoreCase="true"/>
    </rewrites>