Copied to clipboard

Flag this post as spam?

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


  • J 347 posts 602 karma points
    Jun 09, 2020 @ 13:00
    J
    0

    Remove querystring from rewrite rule

    I have a page which is trying to have a friendly URL i.e.

    mysite.com/parent/electrical

    or

    mysite.com/parent/devices

    I use the below URLRewriting code

    <add name="catsTest" virtualUrl="^~/parent/(.*)" destinationUrl="/parent?cat=$1" rewriteUrlParameter="ExcludeFromClientQueryString" ignoreCase="true" />
    

    This arrives to the page but how could i remove the original querystring so when a button i s clicked on the landed page it doesnt forward the querystring on? in this case it forwards on cat even though the links on the page do not have this?

  • J 347 posts 602 karma points
    Jun 10, 2020 @ 07:35
    J
    0

    Anyone? If the Virtual Url is something different then all is ok but seems to occur if the same virtual and destination URL are the same?

  • Steve Morgan 1208 posts 3922 karma points c-trib
    Jun 10, 2020 @ 09:36
    Steve Morgan
    0

    I'm not sure I'm following you correctly.

    Your issue is that this rewrite rule is firing for all URLs including after you've resolved whatever it is that you're trying to redirect and resolve to.

    i.e. cat=x is being appended to all URLs below /parent/ not that these are included on the links.

    It's hard for anyone to give you an answer I think here as it's not clear what your node structure is, what this parent page is doing (I'm assuming paginating and displaying results based on the cat id?).

    If you can explain what you're trying to do and what the problematic URLs are I'm sure someone can solve it for you.

    It looks to me like you actually need a controller on the parent node rather than trying to rewrite these but it's not clear without seeing how this content is being served up.

Please Sign in or register to post replies

Write your reply to:

Draft