Hello,
I apologize for the issue you are facing with redirecting URLs ending with /?lang=en. To resolve this problem, you can create a regex redirection in Rank Math SEO. Here’s how you can do it:
- Go to your WordPress Dashboard and navigate to Rank Math SEO > Redirections.
- Click on the Add New Redirection button.
- In the Source URL field, enter
/product-category/(.*)/?lang=en.
- Select the Regex option in the Match Type dropdown menu.
- In the Destination URL field, enter
/dresses/$1/?lang=en.
- Save the redirection.
This regex pattern will help you redirect URLs ending with /?lang=en to the desired destination without causing any issues like duplicate language parameters.
If you encounter any further difficulties or if the issue persists, please feel free to reply to this ticket, and a human agent from the Rank Math Support team will assist you promptly.
Thank you for reaching out.
Best regards.
Sources:
Solving Redirection Issues Using Rank Math SEO Plugin » Rank Math
Random URLs Redirecting Even When No Redirect Was Created » Rank Math
Why Are Posts Redirecting to www or Non-www Incorrectly?
Hello,
Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.
In order to redirect the URLs with query parameters, please add the following filter on your website and see if that works for you:
add_filter( 'rank_math/redirection/add_query_string', '__return_false' );
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps and please don’t hesitate to let us know if you have any other questions.
Thank you.
Thank you, I will try that.
I have now found a way through the contains method as well.
Regards, Kasper
Hello,
Sure! Let us know how it goes.
Meanwhile, please don’t hesitate to let us know if you have any other questions.
Looking forward to helping you.
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.