Unable to set a rewrite rule to redirect a path

MoTaar 310 Reputation points
2023-11-08T00:14:33.7933333+00:00

Hi, I am trying to block the link https://abc.com/azerty/qwerty/cde/123

I want it to get redirected to https://abc.com/

Basically I want to catch "qwerty" whenever it's in the link and redirect it to host.

Here is how I set up my Rewrite rule:

CONDITION:

1- in the Type of variable to check list, select Server variable.

2- In the Server variable list, select uri_path

3- Under Case-sensitive, select No.

4- In the Operator list, select equal (=).

5- pattern:

.*qwerty.*

ACTION:

Rewrite type list, select URL.

Action type list, select Set.

Components, select Both URL path and URL query string

URL path value: /

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,088 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,024 questions
{count} votes

1 answer

Sort by: Most helpful
  1. KapilAnanth-MSFT 47,491 Reputation points Microsoft Employee
    2023-11-14T11:59:03.8+00:00

    @MoTaar

    I tried to repo your environment and the redirection works as expected for me.

    Direct access backend:

    User's image

    App gateway access:

    User's image

    Also, the Access Logs:

    User's image

    • This indicates the Rewrites are happening successfully.
    • Please check your configuration once again.

    Please note that the browser URL will not change.

    The external users will be oblivious to the URL Path rewrites done by App gateway and will continue to see the URL Path they provided in the request.

    Cheers,

    Kapil

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.