Options -Indexes
RewriteEngine On

# Redirect explicit .html requests to extensionless URLs.
THE_REQUEST ^[A-Z]{3,9}\ /(.+)\.html[\s?] [NC]
RewriteRule ^ %1 [R=301,L]

# Serve an existing .html file when the extensionless URL is requested.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [L]

# Keep the landing page available from the domain root.
DirectoryIndex index.html

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>
