Copied to clipboard

Flag this post as spam?

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


  • Trent Brazeal 8 posts 28 karma points
    Dec 19, 2012 @ 18:07
    Trent Brazeal
    0

    UrlRewriting.net with Encoded query string

    Hi all,

    I am trying to use the built-in UrlRewriting.config file to perform some rewrites.  I've started with trying to rewrite to a category query string.  The destination url I'm wanting/needing in this example is /my-blog?category=Category+1

    The problem is when the query string is Server.UrlEncode(d) and it contains a space. (i.e. Category 1) is encoded to Category+1. 

     

    The url I was trying to rewrite from is /my-blog/category/Category+1 ... but this returns 404 error... Yet /my-blog/category/Category%201 works with the rule below.  I like the + in place of the spaces like Server.UrlEncode is doing as oppose to the %20.

    Any ideas why /my-blog/category/Category+1 doesn't work with the rule below?

     

    Here is the rewrite rule.

     <add name="Categories Query"
          redirect="None"
          redirectMode="Permanent"
          virtualUrl="^~/my-blog/category/(.*)"
          rewriteUrlParameter="ExcludeFromClientQueryString"
          destinationUrl="~/my-blog?category=$1"
          ignoreCase="true" 
        />

     umbraco 4.8.0

    Windows Server 2008 R2 Standard / IIS7

     

    Thanks,

    Trent Brazeal

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies