Hi Michael,
Thanks for getting in touch with us.
By default, Rank Math passes the query strings over to the redirected URL and that is why it seems like it is not working and might even cause redirect loops in certain cases. While we work on an UI option for this, please use the below filter in your theme’s functions.php file to make it work:
https://rankmath.com/kb/filters-hooks-api-developer/#redirect-remove-query
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Hi Todd,
the problem is not the passing of the query string, the problem is that I can’t filter based on the query string… to me it seems the query string is ignored when filtering…
Furthermore the appending of the query string is done wrong:
$this->redirect_to .= ‘?’ . $this->query_string;
Imagine the target URL already has a query string, in this case an & has to be used…
Hello,
front_content.php?idart=77 ==> http://localhost/target1
front_content.php?idart=111 ==> http://localhost/target1
front_content.php?idart=107 ==> http://localhost/target2
I don’t see any relation between the query strings and the target URls. You can simply add a Redirection rule with
Source: ?idart=77
Comparison: Ends with
Destination URL: http://localhost/target1
I hope that helps.
And on a side note – the regex makes more sense to me, since I have about 15 of these IDs which link to target1 and 5 that link to target2…
Hi Pratik,
did you try that? Because it does not work for me.
front_content.php?idart=111 [ends with] ==> http://localhost/target1
front_content.php?idart=107 [ends with] ==> http://localhost/target2
One of the two does not work and it always redirects to i.e. target1 or target2…
Hi Michael,
Thank you for getting back to us.
We are checking this issue and we will be in touch in a short while.
We appreciate your patience. Thank you.
Hello,
Please try adding only query strings in the Source URL:
Source: ?idart=107
Destination: /target1
Comparison: Ends With
Source: ?idart=111
Destination: /target2
Comparison: Ends With
That should fix the issue. Here is a screencast from my setup: https://i.rankmath.com/7zAVO4
I hope that helps.
Hi Pratik,
unfortunately it still does not work for me,
check out this setup:
https://pasteboard.co/IUt3yd8.png
Hi Michael,
We are extremely sorry about that.
We have seen the issue and are in the process of fixing it.
We would appreciate your patience while we get this working.
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.