Posted on

Magento adding .html in the middle of url after last category

I migrated all my products and categories (thousands) over from M1 to M2 and persevered all the URL writes.
I have now found that if we modify a category in M2 it is adding a .html to the end of the category.

This ok as we used that format in the past on M1.
What I have noticed is that it is now adding .html into the middle of product URLs.

So what once would have been


is now


To avoid this I removed the suffix in the category and have now left it blank.
So the product URL would now look like


As a result of this, I am now getting 404 errors on all category links from google as they
are looking for URL with .html extension.

The only solution I can see would be to also remove the .html for products as well, which
would result in all links from google failing to work.

The add a URL rewrite to the .htaccess file like this.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/?(.*).(html)$ /$1 [R=301,L]


so that it would redirect all pages with a .html extension to
the pages with no extension and regenerate URL rewrites for the products and categories.

Would this be the best solution to the issue?

Leave a Reply

Your email address will not be published.