Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

This topic contains 3 replies, has 0 voices.

Last updated by Bruno Kos 3 weeks, 6 days ago.

Assisted by: Bruno Kos.

Author Posts
November 7, 2024 at 10:17 pm #16380136

jonathanF-3

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?

November 8, 2024 at 3:40 pm #16382748

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

On this sandbox:
hidden link

Can you reproduce the issue here?

Regards,
Bruno Kos

November 13, 2024 at 2:03 pm #16397998

jonathanF-3

Hi Bruno,

We have a staging for the website.
It would be easier to give you access to it instead of recreate it on the sandbox if it's ok for you?

November 14, 2024 at 7:06 am #16400811

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

I added that code to the sandbox and translated the category:
hidden link

Can you take a quick look to confirm that this matches your site where 404 occurs?

The topic ‘[Closed] 404 on translated product category’ is closed to new replies.