Background of the issue:
I am experiencing an issue with loading multiple language versions on my site hidden link. The URL structure breaks, and I need to make .htaccess flush all the time. I found a snippet on your blog that helps, but I don't want to use extra code. I would like this to be added to the WPML plugin code as an update so I can delete the snippet. The snippet I am using is: add_filter('mod_rewrite_rules', 'fix_rewritebase'); function fix_rewritebase($rules){ $home_root = parse_url(home_url()); if ( isset( $home_root['path'] ) ) { $home_root = trailingslashit($home_root['path']); } else { $home_root = '/'; } $wpml_root = parse_url(get_option('home')); if ( isset( $wpml_root['path'] ) ) { $wpml_root = trailingslashit($wpml_root['path']); } else { $wpml_root = '/'; } $rules = str_replace('RewriteBase $home_root', 'RewriteBase $wpml_root', $rules); $rules = str_replace('RewriteRule . $home_root', 'RewriteRule . $wpml_root', $rules); return $rules; }
Symptoms:
The URL structure breaks when loading multiple language versions, requiring .htaccess to be flushed constantly.
Questions:
Can you add the snippet to the WPML plugin code as an update?
Is there a way to improve the plugin to avoid using extra code?