Ad

Achieving Flat URL Structure With Woocommerce For SEO

In an attempt to make a multilingual woocommerce website with a flat url structure we thing would be best for our store's seo, we tried every combinaison plugins/features/sustom code/htaccess we know and could not make it happen.

I know WP suggests NOT to remove the base slugs from urls but the main reason is to avoid conflict between slugs and we intend on writing ALL slugs manually.

So, in short lets says we have categoryA and categoryAB (child of A) and a productnamedsomething associated to categoryAB.The usual URL of woocommerce would be: www.domain.com/product-category/categoryA/categoryAB/productnamedsomething

while we would simply want: www.domain.com/productnamedsomething

up to there, the WP htaccess Control plugin was working wonderfull, but adding multilangual fonctionnality made it complicated.

We tried both polylang and WPML and could not achieve in any way our target URLs: www.domain.com/productnamedsomething www.domain.com/fr/unproduitquelconque

However, typing any of these URL in the address bar works and displays the product, without the category tree. But we cannot get menus, category menus and other links to point to a flat url structure.

So the main points here are:

  1. Did anyone succeed in creating flat url structure in woocommerce and what was the wining combinaison of plugins/hack used?
  2. If not, what would be the best way to go about it, manually removing categories using htacess or maybe overwriting theme functions to change widgets and menu links structure in php?
  3. Is all this worth the hassle or is woocommerce's basic url structure better than it feels for a shop's SEO?

Ask clarifications if needed, i'll be glad to discuss this.

Ad

Answer

Have you tried the WordPress rewrite API? https://codex.wordpress.org/Rewrite_API

Ad
source: stackoverflow.com
Ad