12 Oct 2021

Redirect all .HTML URLs to their non-.html equivalent

Add the following to the .htaccess file to redirect all .HTML URLs to their non-.html equivalent

 

RewriteCond %{THE_REQUEST} ^GET\ /(.+)\.html [NC]
RewriteRule ^ /%1? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]