This thread is resolved. Here is a description of the problem and solution.
Problem:
When WPML is enabled and a visitor switches language to /en/, WordPress rewrites .htaccess with:
RewriteBase /en/
and routes requests to /en/index.php. There is no physical /en/ directory as language URLs are virtual. This causes REST API endpoints (/wp-json/, /wp-json/wp/v2/) to break and results in intermittent server-level 404 errors. Disabling WPML stops this behavior, and locking .htaccess prevents the rewrite but is only a workaround.
Solution:
This issue is likely related to a known problem where .htaccess gets overwritten with the language folder. We recommend you ensure to have a full website backup and apply the solution outlined in the erratum. You can find more details and guidance here: Why is .htaccess getting overwritten with the language folder on my WPML website?
If this solution does not resolve your issue or seems outdated, 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 the problem persists, please open 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.
This topic is split from https://wpml.org/forums/topic/menus-not-visible-in-wp-admin-and-wpml-rewrite-base-404-issue-server-level-effect/
This topic contains 2 replies, has 0 voices.
Last updated by 4 days, 14 hours ago.
Assisted by: Lucas Vidal de Andrade.