Remove .html from URL

Should you want to remove .html from a URL you can paste the following in your .htaccess file in the root www/public_html directory:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^YOURDOMAIN.co.za$ [OR]
RewriteCond %{HTTP_HOST} ^www.YOURDOMAIN.co.za$
RewriteRule ^(.*)$ https://YOURDOMAIN.co.za/$1 [R,L]

RewriteCond %{THE_REQUEST} s/+(.+?).html[s?] [NC]
RewriteRule ^ /%1 [R=302,L,NE]

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

An example of the above would be as follows:

test.com/somepage.html

would be redirected to:

test.com/somepage