Options -Indexes -MultiViews
DirectoryIndex index.html
RewriteEngine On
# Redirect the homepage filename to the root.
RewriteCond %{THE_REQUEST} \s/+index\.html[?\s] [NC]
RewriteRule ^index\.html$ / [R=301,L,NE]
# Redirect legacy HTML page URLs.
RewriteCond %{THE_REQUEST} \s/+[^?\s]+\.html[?\s] [NC]
RewriteRule ^(.+)\.html$ /$1 [R=301,L,NE]
# Resolve clean URLs without exposing the underlying HTML files.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [L]
