RewriteEngine On
# If a user explicitly types /index.html, redirect them to the root folder
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ / [R=301,L]


RewriteEngine On

# 1. Remove .html from visible URL and redirect to clean URL
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R=301,L]

# 2. Internally map the clean URL back to the .html file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ $1.html [NC,L]
