This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is experiencing intermittent 'Internal Server Error' messages when trying to access translated pages on a website with WPML and WCFM installed. The hosting company suggested that the issue might be related to a misconfiguration in the htaccess file.
Solution:
We recommended the following steps to resolve the issue:
1. Take a backup of the site for safety reasons.
2. Add the following code in the functions.php file of the 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 the permalinks from the Settings >> Permalinks page by pressing the Save Changes button.
4. Clear all types of caches (site/server, plugin, CDN, and browser).
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 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 issue 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.