Hi guys,
Not sure if the behavior observed for a URL forwarding rule is as expected, so I’m sharing the case in an attempt to clarify it.
Thanks in advance!
Page Rule settings
Basically, this Page Rule acts on URLs that contain /@/
(witch I’ll call “delimiter”) keeping the path before ($1
) and discarding everything after ($2
) it. The delimiter itself is removed as well.
Forwarding URL
Type 302 - Temporary Redirect Source https://example.com/
*
/@/
*
Destination https://example.com/
$1
Example A: Unique match
Source link A contains 1 occurrence of the delimiter:
Example A details
Source link
https://example.com/unique/@/matching
Redirect chain
- [302]
https://example.com/
{unique
}/@/
{matching
}- [200]
https://example.com/unique
The
{
brackets}
are used to highlight matches$1
and$2
in redirectsMatched wildcards
Redirect #1
$1
(forwarded) =unique
$2
(discarded): =matching
Example B: Non-unique match
Source link B contains 2 occurrences of the delimiter:
Example B details
Source link
https://example.com/non/@/unique/@/matching
Redirect chain
- [302]
https://example.com/
{non/@/unique
}/@/
{matching
}- [302]
https://example.com/
{non
}/@/
{unique
}- [200]
https://example.com/non
The
{
brackets}
are used to highlight matches$1
and$2
in redirectsMatched wildcards
Redirect #1
$1
(forwarded) =non/@/unique
$2
(discarded) =matching
Redirect #2
$1
(forwarded) =non
$2
(discarded) =unique
Behavior: Current vs. Expected
In Example B the first occurrence of /@/
was ignored by Redirect #1 and became part of its $1
:
Current redirect chain
- [302]
https://example.com/
{non/@/unique
}/@/
{matching
}- [302]
https://example.com/
{non
}/@/
{unique
}- [200]
https://example.com/non
The
{
brackets}
are used to highlight matches$1
and$2
in redirects
So current behavior requires an extra redirect in the chain compared to expected:
Expected redirect chain
- [302]
https://example.com/
{non
}/@/
{unique/@/matching
}- [200]
https://example.com/non
The
{
brackets}
are used to highlight matches$1
and$2
in redirects
Readings taken
- Blog
-
Community
- Tips/Tutorials
- Discussions
- Page rule syntax
- PageRule Unexpected Results
- Page Rule Wildcard Shenanigans
- I have no idea... forwarding URL!
- And others somehow related but not exactly relevant
- Support
I’m not a developer/programmer, so I’m sorry if I was wrong about any term or concept.
This topic has been edited a few times to make it more succinct and easy to understand.