I've added a permanent 301 redirect to my Magento 2 store to remove .html from my category and product urls by adding the following code to my website .conf file - I'm using Apache

redirectMatch 301 ^(.*)\.html $1

The redirect works fine as I don't get any 404 errors for existing products and categories that have .html in the url but now I have another problem.

I am now getting 404 errors for static content even though I have deployed them on the frontend and backend/admin

If I remove the 301 everything loads a normal. Does anyone know what I've done wrong?

Admin Sales > Order

Product page image

  • 1
    Magento calling many .html files in admin and front side especially on the checkout page.
    – kunj
    Commented May 17, 2018 at 11:17

1 Answer 1


After changing the configuration just add this to your .htaccess of website .conf file so only the URI is rewritten and not the loading of .html files.

RewriteEngine On
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^index.php/?(.*).html$ /$1 [R=301,L]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.