Copied to clipboard

Flag this post as spam?

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


  • jake williamson 207 posts 873 karma points
    Apr 05, 2016 @ 14:01
    jake williamson
    0

    how to include the querystring in UrlRewriting.config?

    chaps,

    maybe i'm missing somit real obvious...

    we've this rewrite to handle years and month based urls for our blog:

    so hitting:

    /blog/category-name/2016/03/

    is actually hitting:

    /blog/category-name/?year=2016&month=03

    trick is now we've added paging and a sort by that get passed as querystring params:

    /blog/category/2016/03/?page=1&sort=datedesc

    i figured changing the 'rewriteUrlParameter' from 'ExcludeFromClientQueryString' to 'IncludeQueryStringForRewrite' would do the trick but i keep getting 404's when i sort the page.

    am i missing something obvious?!

    cheers,

    jake

  • jake williamson 207 posts 873 karma points
    Apr 06, 2016 @ 08:00
    jake williamson
    0

    in the end, i solved this by using a regular rewrite in the web.config:

    <rule name="BlogMonthRewrite" stopProcessing="true">
        <match url="blog/(.*)/([0-9]{4})/([0-9]{2})/$" />
        <action type="Rewrite" url="/blog/{R:1}/?year={R:2}&amp;month={R:3}" appendQueryString="true" />
    </rule>
    

    i'd still love to know what the difference between doing it here and in the 'UrlRewriting.config' and why the qs wasn't appended but for now, this works ;)

  • 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