AFD Premium - 301 Redirect Trailing Slash to no Trailing Slash via Ruleset

Jack Jin MSFT Accenture 80 Reputation points Microsoft Vendor
2024-04-12T14:37:46.5666667+00:00

Hello!

We're looking to remove trailing slash via a ruleset in Azure Front Door Premium via a Ruleset. Looking at the documentation https://learn.microsoft.com/en-us/azure/frontdoor/rules-match-conditions?pivots=front-door-standard-premium&tabs=portal#request-url and server variables that are available https://learn.microsoft.com/en-us/azure/frontdoor/rule-set-server-variables, after a few hours of trial and error we can't seem to put server variable and we can't seem to find a simple rule where all URLs without query string.

We're hoping to map a request example with

/abcd/efg/?queryk=queryvalue#anchor
to
/abcd/efg?queryk=queryvalue#anchor without the / after efg and before ?queryk

Any help is appreciated!

Thanks,

Jack

Azure Front Door
Azure Front Door
An Azure service that provides a cloud content delivery network with threat protection.
580 questions
0 comments No comments
{count} votes

Accepted answer
  1. ChaitanyaNaykodi-MSFT 23,031 Reputation points Microsoft Employee
    2024-04-12T19:16:29.5766667+00:00

    @Jack Jin MSFT Accenture

    I understand you are trying to set-up a Redirect using Azure FrontDoor where you want rewrite the url_path /abcd/efg/?queryk=queryvalue#anchor to /abcd/efg?queryk=queryvalue#anchor without the / after efg and before ?queryk

    In order to achieve the URL rewrite you can try setting the rule-set for the Request path as shown below

    User's image

    I tried it on my end and can see the trailing slash was removed.

    User's image

    Hope this helps! Please let me know if you have any questions. Thank you!


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful