woocommerce offtopic – Disable duplicate WC product category URLs

Question

WC generates duplicate URLs when using category slugs.

Example:
demoshop.com/cat-1/product-a

The same product can be accessed from any URL if slug “cat-1” is modified, e.g.:
demoshop.com/modified/product-a will lead to a status code 200 as well.

From a SEO perspective this is not preferrable and I would like to modify the behaviour as follows:
If the product page is accessed via the correct url a 200 is sent.
If the product page is accessed via any other url a 301 to the correct url is sent.

If the product has muliple categories assigned, the primary one should be considered.

Any hints how to realize that?

0
Mirko 1 month 2023-02-21T08:54:05-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse