This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing frequent 404 errors on the translated versions of your pages (EN and IT) on your website, which uses DE as the default language, this might be due to an issue with third-party plugins affecting the rewrite rules.
Solution:
We recommend trying the following steps to potentially resolve this issue:
1. Ensure you back up your site for safety.
2. Insert the following code into the
functions.php
file of your theme:
add_filter('mod_rewrite_rules', 'fix_rewritebase');<br />function fix_rewritebase($rules){<br /> $home_root = parse_url(home_url());<br /> if ( isset( $home_root['path'] ) ) {<br /> $home_root = trailingslashit($home_root['path']);<br /> } else {<br /> $home_root = '/';<br /> }<br /> <br /> $wpml_root = parse_url(get_option('home'));<br /> if ( isset( $wpml_root['path'] ) ) {<br /> $wpml_root = trailingslashit($wpml_root['path']);<br /> } else {<br /> $wpml_root = '/';<br /> }<br /> <br /> $rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);<br /> $rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);<br /> <br /> return $rules;<br />}3. Re-save your permalinks from the Settings >> Permalinks page by pressing the 'Save Changes' button.
4. Clear all types of caches: site/server cache, plugin cache, CDN cache, and your browser cache.
For more details, visit https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/
If this solution does not apply to your case, or if it becomes 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. Should you need further assistance, 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 contains 3 replies, has 0 voices.
Last updated by 1 month, 1 week ago.
Assisted by: Noman.