Skip Navigation

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

Problem:
The client was experiencing 404 errors on their multilingual website when accessing translated pages and taxonomies for the first time. The issue persisted even after disabling various caching solutions and plugins. The WPML String Translation plugin was identified as part of the problem, particularly when switching between languages on posts.
Solution:
We recommended the following steps to address the issue:
1. Navigate to WPML > String Translation.
2. Search for

wc/file/transient

and

wc-api

under the WP Endpoints domain.
3. If these strings are translated (indicated by a pencil icon below the language flag), select both and delete them from String Translation.
4. Go to "Settings > Permalinks" and resave the permalink structure.
5. Clear the caches from the site and browser, then check the page again.
Additionally, we suggested checking the guide on handling .htaccess issues with WPML at https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/.

If this solution does not resolve the issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If problems persist, please open a new support ticket at https://wpml.org/forums/forum/english-support/.

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.

This topic contains 6 replies, has 1 voice.

Last updated by kelvinV 1 month ago.

Assisted by: Prosenjit Barman.

Author Posts
December 1, 2024 at 8:52 pm #16463719

kelvinV

Background of the issue:
I'm in the process of translating my blog from English to Dutch on hidden link using WPML. I've translated all pages, custom taxonomies, and a few posts.

Symptoms:
For most of the translated taxonomies and the homepage, the site returns a 404 error on the first visit. The page works upon refreshing.

Questions:
How can I fix the 404 error on the first visit for translated pages and taxonomies?
Is there a specific setting in WPML that needs adjustment to prevent 404 errors on translated pages?

December 2, 2024 at 1:54 am #16464047

kelvinV

Things I have done in the meantime that didn't work:

- disable Siteground caching
- disable memcached caching
- disable cloudflare caching
- deactive Yoast plugin
- Clear the Cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Fix WPML table collation
- Assign translation status to duplicated content
- Set language information
- Fix post type assignment for translations

Hope someone can help me, thank you.

December 2, 2024 at 5:41 am #16464178

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

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

We can't see this problem on your site. I tried it with the following Dutch pages, and they loaded fine the first time without giving a 404 error.

hidden link
hidden link
hidden link

How can we see this problem on your site?
Is there a specific page we need to visit?

If you can share a video of the problem with us, that would be great.
You can use the free online screencast service Loom—hidden link.

Regards,
Itamar.

December 2, 2024 at 8:19 am #16464484

kelvinV

Hi there, thank you for looking into it. At the time you wrote your response, I just figured out that apparently the WPML String Translation plugin was the culprit. At least, for part of the problem. To give you an idea of what the first issue was: if you were to go to tastingsunsets.com/nl/ (the Dutch homepage) and scroll to the bottom, you will see "Bezienswaardigheden". If you click on it, it'll take you to hidden link but give a 404 error not found. If you refresh the page, you will see that that page actually does exist in Dutch – it loads and renders. I think by deactivating that plugin, this issue is fixed.

However, I still have an issue when switching from English -> Dutch for a specific post. If you're reading an English post (let's say hidden link) and want to switch it to the Dutch version of it (you can do so by scrolling down and clicking "Nederlands" in the bottom right corner), you will get a 404 again. Then on refresh you will see the post at hidden link. I even sometimes get a 404 by doing it the other way around (Dutch -> English). So still some troubleshooting to go I fear. Thanks again!

December 3, 2024 at 6:35 am #16469456

Prosenjit Barman
Supporter

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for contacting WPML Support.

I understand the issue you're facing. Since disabling the String Translation plugin resolves the problem, it's likely that an endpoint or some settings were incorrectly translated via String Translation, leading to the issue. Please try the following steps and check if they help in solving all issues.

- Please go to WPML > String Translation
- Search for wc/file/transient and wc-api. Both will appear under the WP Endpoints domain.
- Check if they are translated(you should see a pencil icon just bellow the language flag). if so, select both and delete them from String translation.
- Go to "Settings > Permalinks" and resave the permalink structure.
- Clear the caches from your site and browser and then check the page again.

Sometimes, an incorrect translation of the WooCommerce endpoint can cause a 404 error when accessing the other language version. If that’s not the issue, you can follow the instructions in the guide below to see if they help resolve the problem.

- https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/

Please give it a try and let me know if you need further assistance in this matter. I'll be happy to help.

Best regards,
Prosenjit

December 3, 2024 at 6:46 am #16469468

kelvinV

Hi Prosenjit

Thank you for looking into this!

I don't use any WooCommerce plugins or things like that, and if I re-enabable the plugin and search for those strings, I don't find them. I also ran into a different error now that I deactivated the plugin, because (custom) taxonomies aren't translated anymore. The word "destinations" should become "bestemmingen", but it stays "destination". Similar for "category" that should be translated to categorie, but isn't. This is returning quite a lot of 404s already for our visitors. So it seems like neither enabling nor disabling the plugin is a 100% fix. To add to that, the switching from English -> Dutch for a specific post error still remains as well.

I have setup a staging website and enabled/disabled plugin by plugin, and I only get a (somewhat) working website when I disable the WPML String Translation plugin. Even with all 30 other plugins (bar the WPML String Translation one), the site works. The moment I enable WPML String Translation (even with all other plugins off), the main error of 404s that get solved by refreshing, pops up again.

So a strange issue here indeed...

Hopefully we can find a fix! Thank you once again for looking into it!

Kind regards
Kelvin

December 3, 2024 at 6:52 am #16469485

kelvinV

So I *just* found that Siteground did some rewrites on their end to "speed up" the page loading. This was causing some issues because it dynamically rewrites the page and they can't handle the /nl part that well. I've tested my website and all seems to work now, even with the WPML String Translation plugin enabled! Thank you though for looking into it, this issue is resolved.