More in this section

Rewrite rules

2 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    05 Aug 2010
    04 Nov 2010
    Link to this post

    Im using the Advanced URLRewriter to rewrite url's from the old website. The old website had lots of urls like:


    For each of these I want to redirect them with a 301 to my news homepage. I have setup the following rule, which works (partly):

    <rule mode="PermanentRedirect">

    The only problem I am getting is that the querystring is automatically appended, so:


    Redirects to:


    Which is not what I want. I dont want to append the that happening just because it is within the brackets?

    Thanks in advance
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    05 Nov 2010
    Link to this post
    Hello higgsy,

    Thank you for using our services.

    Since the UrlRewriter works with regular expressions it users Regex.Replace method to replace the matched result with the rewrite rule. In your case the group for the query string is excluded from the match rule and the regular expression leave it. You can try with rule like this if you do not want to pass the query string parameter:

    This rule will also match the query string and replace it in the replace method call.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered