How to remove the last .html that appears on the site

When ever i make a page so it ends with .html and therefore when i open the page it also shows like website.com/how.html
but i dont want to show that .html

I searched on google and they are saying you need to tweak into .htaccess but ig netlify doesnt have .htaccess file so how do i remove the .html now?

Hey @Samrridh

By default, if you have a page example.com/about.html, it is automatically available via example.com/about. However, you can also enable “Pretty URLs” under Site Settings > Asset Optimization

Also check out

umm where is this asset optimization in site settings

It is under Build & deploy > Post processing

I enabled this option and nothing happened. The .html at the end of my URL is still there and I have redeployed several times; as well as waiting a few days and constantly refreshing.

Hey @HaydnBoss07

Can you provide the URL for the site you seeing this issue on?

If deploying from git, can you also share the git repository?

https://www.catwarenig.ga/404.html is the URL the issue is on (as well as all over URLs)
Repo (github.com) This is the repository

Thanks @HaydnBoss07.

From testing, .html stripping does work as intended. What doesn’t (seem to) work is stripping the extension when a path ending in .html is entered manually into the address bar (i.e. /page1.html isn’t redirected/rewritten to /page1.) I don’t know if this is intended or not (ping @hillary for possible clarification.)

Best practice IMHO is to not use extensions in links either internally or externally. So instead of having

<a href="/page1.html" title="Page 1">Page 1</a>

use

<a href="/page1" title="Page 1">Page 1</a>

and add a <link> element with rel="canonical" e.g.

<link rel="canonical" href="https://example.com/page1">