We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Simple Redirect does not workRSS

2 replies

Last post Feb 22, 2021 09:51 AM by Jalpa Panchal

  • Simple Redirect does not work

    Feb 13, 2021 06:55 PM|alexandros_k|LINK

    Hi,

    I want to redirect this page:

    /p/how-it-works

    to

    /how-it-works

    And i've setup this rule:

    <rule name="test" patternSyntax="Wildcard" stopProcessing="false">
                        <match url="*/p/how-it-works*" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="/how-it-works" />
    </rule>

    However, it does not work. I'm unable to find out why.

    Any clues?

    Thanks in advance.

    Alex

  • Re: Simple Redirect does not work

    Feb 15, 2021 03:28 AM|Jalpa Panchal|LINK

    Hi Alex,

    you could try to use below rule:

    <rule name="test" patternSyntax="ECMAScript" stopProcessing="true">
                        <match url="^p/how-it-works$" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="/how-it-works" />
    </rule>

    Wildcard matching assumes “exact match”. For an expression like “blog”, it would match “blog” and only “blog”.

    Regex matching assumes “partial match”. In this case, “blog” will match “blogger”, “demo/blog”. If you want an exact match you need to change the match expression to “^blog$”.

    you could refer to the below link for a more detailed explanation:

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#rule-pattern-syntax

    Regards,

    Jalpa

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: Simple Redirect does not work

    Feb 22, 2021 09:51 AM|Jalpa Panchal|LINK

    Hi,

    Is your issue solved?

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Jalpa.

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.