I want to redirect all requests that end with
This should match all urls such as these-
This is what i'm using-
rewrite /abcd/?$ https://example.com/products/abcd permanent;
The problem- if someone visits
/products/abcd, this url also matches the rewrite rule, and goes into an infinite loop.
I also tried this regex, but that doesn't match any url (i.e. no redirects happen)-
rewrite /(^products/)abcd/?$ https://example.com/products/abcd permanent;