Background of the issue:
I am trying to resolve a 404 error on translated product categories in WooCommerce. This is a follow-up for the post: #post-16091143. The issue persists even after contacting the SEO Press plugin as suggested. The problem disappears when the SEO plugin is disabled but it also only appear after translating a new products for exemple or anything related to WooCommerce. The SEO Press team suspects it might be related to a code provided by WPML for a similar issue previously. Here is the code: // https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/ 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:
404 error on translated product categories in WooCommerce when the SEO Press plugin is enabled.
Questions:
Is the issue related to the code provided by WPML?
What can cause the 404 error on translated product categories?