Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are experiencing issues with redirections set up in Rankmath being overridden by WPML, causing URLs to redirect to incorrect language versions. This problem arises because you are using identical slugs for pages in different languages.
Solution:
We recommend ensuring that all your page slugs are unique across different languages on your website. For instance, instead of using 'wms' and 'wcs' for both English and French pages, use 'wms-fr' and 'wcs-fr' for French. This change should resolve the redirection issues. Here is a general guideline from WordPress on the importance of unique slugs: https://wordpress.stackexchange.com/questions/35315/must-slugs-be-unique

If this solution does not apply to your case, or if it seems outdated, please check the related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by Dražen 7 months, 3 weeks ago.

Assisted by: Dražen.

Author Posts
September 5, 2024 at 12:08 pm #16144901

montaS

Background of the issue:
I am trying to set up redirections on my site hidden link using Rankmath. I made the following redirection: en-gb/wms/software/wcs/ -> hidden link. However, when I view the redirection, it goes to this URL: hidden link. From Rankmath, I get the following answer: This particular redirection is being handled by the WPML plugin as you can see from the x-redirected-by: WPML. I have more URLs with redirection problems: en-gb/wms/software/rma/ -> hidden link goes to hidden link, en-gb/wms/software/shipping/ -> hidden link goes to hidden link, en-gb/wms/software/stock-management/ -> hidden link goes to hidden link.

Symptoms:
Redirections set up in Rankmath are being overridden by WPML, causing URLs to redirect to incorrect language versions.

Questions:
How can I solve the issue of WPML overruling Rankmath redirects?

September 5, 2024 at 12:44 pm #16145093

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

please share the Duplicator package in the next reply.

Regards,
Drazen

September 9, 2024 at 7:05 am #16153990

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I checked and could see the issue. It seems there is redirect even without Rank Math plugins, and that is because your structure is not correct. For example hidden link, that page doesn't exist since your WCS in en-gb, doesn't have the correct parent page set. Try to visit it and you will see the URL is different than the one you expected.

What I did was:

- disable all plugins, leave active only WPML, and switch to a default theme
- Check the WCS page, see the URL is wrong and non-existent
- Published Software page in en-gb, it was a draft
- Set WCS page to have parent software, so the structure is correct
- Visit the link and make sure it works
- Enable Rank math and can see it redirects fine now

hidden link

Regards,
Drazen

September 9, 2024 at 10:47 am #16155426

montaS

Hi Drazen,

For SEO reasons we removed the software page in en-gb.
I was able to connect a different parent page to WCS by switching of the "Set page parent for translation according to page parent of the original language" by "Posts and pages synchronization" in the WPML settings.

The url structure hidden link is the desired structure for this page.

What settings i have to chance that WPML will not overide the manual redirects i put in Rankmath?

With kind regards,
Martien Verhaar

September 9, 2024 at 11:51 am #16155965

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Martien,

as I have explained in the last reply, there was no issue with the WPML overriding redirect in Rank Math, "wrong" redirect happen also without Rank Math, with only WPML, because the page/URL didn't exist so WPML / WP opened closes the similar page. It is not an issue related to Rank math as you reported, and it is somehow expected as the page/URL doesn't exist.

As for your last reply, I am not sure I understand your question, do you still have issues after following my suggestion or do you face some other?

Regards,
Drazen

September 9, 2024 at 4:52 pm #16157920

montaS

Hi Drazen,

I will try to explain it better.

hidden link this was the old url.

For SEO reasons in the en-gb version of the website we want to go this url:

hidden link

And we want to redirect the old url to the new one:

hidden link -> hidden link

This page we want to delete: hidden link

When i set it up all went well till i put the redirects into Rankmath some of them are working correctly but a few are going to different pages then what i put in the redirect.

This are the redirects i made

hidden link -> hidden link (works good)

hidden link -> hidden link (works good)

hidden link -> hidden link (works good)

hidden link -> hidden link (works good)

hidden link -> hidden link (works good)

hidden link -> hidden link (NOT Good goes to hidden link)

hidden link -> hidden link (NOT good goes to hidden link)

hidden link -> hidden link (NOT good goes to hidden link)

hidden link -> hidden link (NOT good goes to hidden link)

hidden link -> hidden link (NOT Good goes to hidden link)

Between the redirects which are going to the wrong pages i see 2 similarities some pages go to the French version other pages go to the "fulilment-services" vertical.

The developers from Rankmath had a look at this situation and they told me that the redirects which are going to the wrong pages are handled by WPML.

I will attach the images i got from the Rankmath developers.

So my question is how can i set it up that those redirects are going to the correct pages?

With kind regards,
Martien Verhaar

redirect by wpml 4.png
redirect by wpml 3.png
redirect by wpml 2.png
redirect by wpml 1.png
September 10, 2024 at 6:07 am #16159306

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

okay, thanks. So basically issue is not with the wrong redirect, but that Rank math redirect rules is not working for WPML 2nd language.

I am checking the test site you shared with me and the URLs you mentioned, but I see redirects happening there fine. Can you please check and share with me 1 test URL I can use to see this not working?

Regards,
Drasen

September 10, 2024 at 10:01 am #16160439

montaS

Hi Drazen,

I installed a backup from the test.gomonta.com now the problem is again visible.

Hereby 4 urls which are not following the redirect path.

Source: Redirected to: Wrong redirect final destination:

Source: hidden link
Redirected to: hidden link
Wrong redirect final destination: hidden link

Source: hidden link
Redirected to: hidden link Wrong redirect final destination: hidden link

Source: hidden link
Redirected to: hidden link
Wrong redirect final destination: hidden link

Source: hidden link Redirected to: hidden link
Wrong redirect final destination: hidden link

As you can see only 2 urls are going to a different language.
The other 2 url's are going to a different parent page inside the en-gb language.

Let me know if you need more information about the error?

With kind regards,
Martien Verhaar

September 10, 2024 at 10:48 am #16160582

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

I have checked, and this causes an issue because you are using the same slug for pages in other languages, for example, wms and wcs. This is not recommended and can cause issues even without WPML; only with WP. If you change them to wms-fr and wcs-fr, redirect works just fine: hidden link

Note that also by WP it is recommended to use a unique slug across your website:
- https://wordpress.stackexchange.com/questions/35315/must-slugs-be-unique

If you do not agree with this, I can double check with our 2nd tier, but in general, this is advised to use to avoid issues inside WordPress.

Regards,
Drazen

September 10, 2024 at 3:43 pm #16162689

montaS

Hi Drazen,

I chanced the French url's and those redirections are working fine now.

I also chanced the 2 other url's but they are still redirecting to the wrong url.

Source: hidden link
Redirected to: hidden link
Wrong redirect final destination: hidden link

Source: hidden link
Redirected to: hidden link
Wrong redirect final destination: hidden link

How can i solve this 2 url's?

Thanks in advance,

With kind regards,

Martien Verhaar

September 11, 2024 at 7:00 am #16164494

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Martien,

still, the cause is the same problem with multiple slugs across your website.

For example, in en-gb you have 2 different pages with a shipping slug, and also you have the same Shipping pages in another language again with the same slugs. I advise you to recheck all your pages and make sure they all have unique slugs across the website.

For example, I changed for shipping in en-gb for both pages, and the redirect works fine: hidden link

Regards,
Drazen

September 11, 2024 at 8:53 am #16165244

montaS

Hi Drazen,

I will check all slugs.

do i understand you well when you say it's not good to have more exact identical slugs in one language?

Or is it not good to have more exact identical slugs on the whole website?

If we cannot have identical slugs on the whole website that will be a problem with for example en-usa and en-gb but also for nl and nl-be this are bassicly the same languages.

Thank in advance,

With kind regards,
Martien Verhaar

September 11, 2024 at 11:44 am #16166218

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

in general, across websites it is not advised to have the same slugs as it will cause issues with server / WP / WPML redirecting to the wrong page, this time it might be WPML but some other times, the wrong page might be caused by something else. To avoid any such issue it is best to have them unique across your website / translated.

Regards,
Drazen