18

How do I remove the .html suffix from the product pages?

  • From just the product pages? – philwinkle May 12 '16 at 21:36
  • The .html suffix only seems to appear on the product pages. The CMS pages don't show .html, nor does the home page. – MikeMason May 12 '16 at 21:39
  • Categories should also show .html - would you like to remove it or change it? – philwinkle May 12 '16 at 21:39
  • Ahhh yes, you're correct, the category page has it too. I'd prefer a forward slash in its place. – MikeMason May 12 '16 at 21:40
25

Open your admin panel navigate on Stores->configuration->Catalog click on Search Engine Optimization tab

Here you can remove

Product URL Suffix =

Category URL Suffix =

enter image description here

Make these fields blank (remove .html from both fields) save the config and reindex and clear cache of your store. it's done!

  • Thank you for the reply. Unfortunately, when I removed the .html, I received a 404 on all product and category pages? – MikeMason May 13 '16 at 9:48
  • Did you reindex and clear cache ?? – Arunendra May 13 '16 at 9:54
  • Yes, but it still shows 404 :-/ – MikeMason May 13 '16 at 9:55
  • This is the right way for achieve this functionality. Delete var/generation folder retry and also see log files for any errors – Arunendra May 13 '16 at 9:58
  • Okay, thank you. Where are the log files located? – MikeMason May 13 '16 at 9:59
6

You can just remove .html suffix from your admin panel.

Go to AdminPanel,

Stores -> Configuration -> Catalog -> Catalog

Go to Search Engine Optimization Section,

Unset value for textfield inside Product URL Suffix

Same as you can do it for category url suffix below another field is Catogory Url Suffix.

If you can do any text with this field like .php then its display suffix as .php in your link.

Remove var folder and run commnad php bin/magento indexer:reindex

  • This works well in Magento 2.1. – Wireblue Jun 9 '17 at 0:14
  • 1
    What about the indexed content in search engines? – Frank Groot Jun 29 '17 at 13:52
  • @FrankGroot, they no longer reference the page. It will always throw a 404. It will take time and crawlers will update the new links. How long would it take? I have no idea. – Mohammed Joraid Jul 4 '18 at 3:32
  • @M.Joraid And that is not the way to go, because you will lose history in the search machines. So you have to write 301 rewrite rules for those links, otherwise you will get penalized by the search engines :) – Frank Groot Jul 5 '18 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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