When a page is visited using a URL that ends with .html, I'd like the URL to change to having no extension and report 301 permanently redirected. I'm having serious difficulty. After reading a lot of documentation and tutorials, and searching Stack Overflow for hours, the closest I've achieved is the opposite (URLs with no extension having one added) with this code:
<Location />
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule ^(.*)$ https://%{HTTP:Host}%{REQUEST_URI}.html [L,R=permanent]
</Location>