This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with rewrite rules like
RewriteRule ^bs/wp-login.php /wp-login.php [QSA,L]
and similar for other language directories, it might be due to third-party plugins calling the
flush_rewrite_rules(true)
function excessively.
Solution:
We recommend trying the following steps:
1. 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 /> $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 /> $rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);<br /> $rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);<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, 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 issues persist, 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 1 replies, has 1 voice.
Last updated by 3 days, 23 hours ago.
Assisted by: Noman.