Wordpress duplicate pages with multiple dashes in url

Viewed 122

Something went wrong, I ask for help)))

There is a WP site with Woocommerce There are many duplicates, no matter what it is, page, category or product. Duplicates with dashes (hyphens), and with a different amount, from 2x to infinity

Now the duplicates are like this:

  • site.com/category/--first-product-cat/
  • site.com/category/first----product---cat/
  • site.com/category/first-product-cat-/

Added

RewriteCond %{REQUEST_URI} ^(.*)--(.*)$
RewriteRule . %1-%2 [R=404,L]

That's how they all give 404

The problem is that the page usually opens as if it were a regular duplicate, but with a 404 response, but the 404 wp page does not open directly

Moreover, a 404 page exists and other non-existent pages give 404 and open a 404 page

Added ErrorDocument 404 site.com/404/ does not work

What could be? where to dig? Do not judge strictly, htaccess is not strong in rules. Maybe I'm doing something wrong initially?

P.S.

Revealed another oddity, such links give 200

  • site.com/---shop/product/
  • site.com/shop---/product/
1 Answers

Oleg ! Thanks for your question! I also faced with this issue now. After some research I haven't found the solution, but found some information that can be useful in this case.

  1. This is not a big issue for SEO The main reason I started fixing this bug (or feature :-)) is likely SEO issues. But after some research, I found that the posts have the canonical meta tag out of the box. And you don't have to worry about that because search engines will see all these pages as one indexed canonical URL(

    /some-post

    /some---post

    /---some---post--

Just check that you have meta canonical tag in your posts.

  1. After some research, I found this bug ticket #14773. The bug reported 12 years ago was fixed 7 years ago and flagged for a future release. But it has not been released since then.
Related