Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL param transformation #3940

Open
taylor-onfido opened this issue Nov 20, 2024 · 4 comments
Open

URL param transformation #3940

taylor-onfido opened this issue Nov 20, 2024 · 4 comments

Comments

@taylor-onfido
Copy link

taylor-onfido commented Nov 20, 2024

Summary

I have the following setup:

image

When I visit this url: /blog/?category[0]=6

It is transformed into /resources-2/?category0[]=6

Any idea why this is happening?

Environment

Browser: Chrome
Browser Version: Version 130.0.6723.92 (Official Build) (arm64)
WordPress Version: 6.7
Redirection Version: 5.5

@taylor-onfido
Copy link
Author

Also, I'm sorry for posting this here. My client is on WP Engine. Therefore, I can't log in and post to Matt's website.

@vaz
Copy link

vaz commented Nov 22, 2024

Your screenshot comtains the complete story.

Source and target URL you understand. /blog/ to /resources-2/ as expected.

The option in between says "Query params: Ignore and pass parameters to the target".

Let's pick that apart to interpret it, there are two things being said, "ignore" and "pass to target".

  • The ignore part is about matching a URL to the Source. When a request comes in, any query param is ignored while checking if it matches the Source defined here.
    ** /blog/, /blog/?abc=123 and /blog/?utm_source=facebook.com all match this rule's Source /blog/ because of the ignore part.
  • The redirect location is usually just the Target written here.
    • but the "and pass parameters to the target" part of that option means, those query params you ignored while matching against Source, hold on to them actually and just re-append them to the target.

So your rule does exactly what it says it does. Matches a URL /blog/ with any query parameter (including none), redirects to /resources-2/ but also passes query params from original URL to the new target URL.

/blog/ becomes /resources-2/. /blog/?abc=123 becomes /resources-2/?abc=123. It's working as designed.

@vaz
Copy link

vaz commented Nov 22, 2024

In other words check that option dropdown to find a behaviour matching what you really wanted.

@taylor-onfido
Copy link
Author

It's not the complete story though. Why are the params transformed from category[0]=6 to category0[]=6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants