Need help with redirect rules

What is the name of the domain?

/www.domain.com

What is the issue you’re encountering

I need help since I dont know what to do with the following:

What steps have you taken to resolve the issue?

Redirect rule: Wildcard pattern with Request URL: https://www.domain.com/*/abc/ and Target URL: https://www.domain.com/${1}/
This works fine with https://www.domain.com/sub1/abc/ or https://www.domain.com/sub1/abc (without /) and both return to https://www.domain.com/sub1/
It also works fine with https://www.domain.com/sub1//sub2/abc/ (with /) to return to https://www.domain.com/sub1//sub2/
but not working (page not found) with https://www.domain.com/sub1//sub2/abc (without /)

Thanks,

I just ended up adding another rule without / and seemed working.

There are two things at play here:

  1. https://www.domain.com/sub1//sub2/abc and https://www.domain.com/sub1//sub2/abc/ are technically two different URLs — some applications and web servers might interpret them in the same way, others won’t;
  2. depending on your zone settings, successive forward slashes like // might be normalised to / before redirect phase.

Creating two separate rules works, you could also try changing your wildcard pattern to something like https://www.domain.com/*/abc* since wildcards can match on zero or more characters, meaning that both URLs /abc and /abc/ (but also /abc/123, keep that in mind) will redirect.

2 Likes

@ncano thanks for your reply. Looks like I will keep two separate rules.
In this case, the requested URL should be like “end with” /abc with or without / at the end so I guess https://www.domain.com/*/abc* won’t be used.
Thanks again for helping me learn about with or without / are technically two different URLs and wildcards can match on zero or more characters

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.