How do I remove the .html suffix from the product pages?
-
From just the product pages?– philwinkleCommented May 12, 2016 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.– MikeMasonCommented May 12, 2016 at 21:39
-
Categories should also show .html - would you like to remove it or change it?– philwinkleCommented May 12, 2016 at 21:39
-
Ahhh yes, you're correct, the category page has it too. I'd prefer a forward slash in its place.– MikeMasonCommented May 12, 2016 at 21:40
2 Answers
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 =
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? Commented May 13, 2016 at 9:48
-
-
-
This is the right way for achieve this functionality. Delete var/generation folder retry and also see log files for any errors Commented May 13, 2016 at 9:58
-
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
-
-
1
-
@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. Commented Jul 4, 2018 at 3:32
-
1@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 :) Commented Jul 5, 2018 at 13:33
-
if you "Remove var folder" wouldn't that also remove
.htaccess
which would be bad?– BarryCommented Oct 29, 2019 at 13:31