Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

Tagged: ,

This topic contains 10 replies, has 1 voice.

Last updated by Bobby 6 days, 21 hours ago.

Assisted by: Bobby.

Author Posts
February 26, 2025 at 4:48 pm #16752347

digitalM-7

Background of the issue:
I am experiencing an issue with 404 redirects on my site hidden link. When I visit hidden link, I correctly receive a 404 page. However, if I visit hidden link, it shows a 404 page and then redirects to the homepage. If I disabled this then it works properly: hidden link

Symptoms:
404 page redirects to the homepage unexpectedly.

Questions:
How do I fix this without having to disable all browser language redirects: hidden link

February 26, 2025 at 6:57 pm #16753097

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Thank you for contacting WPML support.
While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with the first debugging steps or if I can help with the issue quickly.

Is the English version of the page saved as a draft? If you publish it, does the error persist? Do you have this setting for pages: WPML -> Settings -> Pages (page): "Translatable - use translation if available or fallback to default language".

If yes, it's a known issue that has been reported to our devs already. For now the only workaround is to publish or trash the draft.

Best Regards,
Otto

February 26, 2025 at 7:07 pm #16753114

digitalM-7

Hello, it is not set as a draft. It's set as a 404 page template in elementor.

No, I have it set to WPML -> Settings -> Pages (page): "only show translated items"

February 28, 2025 at 8:56 pm #16762766

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

When the browser language redirection is enabled the browser's language will be detected and a redirection will be triggered.

For example, I am using an English browser.

I Visit hidden link

I see the 404 correctly

The redirection triggers (because I am visiting a version that is not in English)

The proper redirection in this case is the EN homepage.

IF I visit the page hidden link again for a second time on the same browser, within the 24hours time frame the redirection will not trigger.

The reason it does not trigger when you first visit hidden link is because it's already in EN so no redirection gets triggered.

Please let me know your results,
Bobby

February 28, 2025 at 9:55 pm #16762938

digitalM-7

I am not understanding. The 404 page is in English (which is the same as your browser) so why would it redirect you to the homepage?

March 3, 2025 at 6:24 pm #16770483

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

I see what you mean, in theory the redirect is correct, as your site is using directories such as /en-us/ no URL should be used without it, and instead it should redirect to /en-us/829h rather than the homepage.

There is possibility this is expected as it's a 404 page we find fit to redirect to the homepage, however, I will have to confirm this with our team first.

March 3, 2025 at 7:22 pm #16770634

digitalM-7

Thank you, please let me know what you find.

March 5, 2025 at 1:24 am #16776396

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

We are still working on this, once I have some feedback I will update you here.

March 7, 2025 at 6:01 pm #16789602

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

We located the issue and have a workaround available.

Please note that before moving forward with any code provided by our team or a third party to always have a working backup in place.

Navigate to wp-content/plugins/sitepress-multilingual-cms/dist/js/browser-redirect/app.js

Locate:

&&this.addQueryVarsToRedirectURL(r)+(window.location.hash?window.location.hash:"")}}

Replace with:

&&this.addQueryVarsToRedirectURL(r + this.window.location.pathname)+(window.location.hash?window.location.hash:"")}}

The issue has also been escalated to our dev team which will be making this a permanent fix in upcoming versions of WPML.

March 7, 2025 at 6:24 pm #16789654

digitalM-7

Do you have an estimate on when the fix will be released? I would prefer to wait rather than trying to change code and risking causing other issues.

March 7, 2025 at 10:49 pm #16790426

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Unfortunately I don't have an eta for this at the moment.