Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lachlann 344 posts 626 karma points
    Apr 12, 2011 @ 22:03
    Lachlann
    0

    URL rewriting exclude directories

    Hello all

    I have a URL rewriting rule that maps all incoming .htm requests to .aspx this works really well except when it comes to the backend and things like the tinyMCE html view dont work because the file is .htm

    my rule looks like this:

    <add name="catchAll"
                   redirect="Domain"
                   ignoreCase="true" rewriteUrlParameter="ExcludeFromClientQueryString"
                   virtualUrl="http://www.domain.com/(.*).htm"
                   redirectMode="Permanent"
                   destinationUrl="http://www.domain.com/$1.aspx" />

     

    Is there a way to exclude areas from this rewriting rule? so that it doesnt interfeed with backend stuff?

     

    thanks

     

    L

     

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Apr 13, 2011 @ 14:27
    Tim
    0

    Yes, you just need to ensure that the matched path doesn't have /umbraco/ in the string, using regexp backreferences. Here's an example rule where I match for something with htm except for in the umbraco folder:

    <add name="rewriteHtm"
          virtualUrl="^~/((?!umbraco/).htm)$" 
          rewriteUrlParameter="ExcludeFromClientQueryString"
          destinationUrl="~/$1.aspx" redirect="Application"
          ignoreCase="true"  redirectMode="Permanent"/>

    Hope that helps!

    :)

  • Lachlann 344 posts 626 karma points
    Apr 16, 2011 @ 14:08
    Lachlann
    0

    Hi tim thanks! i think that is almost it however that caused a faild to execute URL can i confirm that when the URL is matched with the excluded directory does the rewrite just cancel or does it try and rewrite to seomthing else?

     

     

    L

Please Sign in or register to post replies

Write your reply to:

Draft